Const int num_years

Assignment Help C/C++ Programming
Reference no: EM13161439

 

How do you get this program to get both player input and then display results(As described on bottom)

#include

const int NUM_YEARS=15;//The number of years

const int NAME_SIZE=32;//The max size of the player name string

const int POINTS_GAME=16;

const int MIN_YEAR=2001;//The lowest year is 1999

const int MAX_YEAR=2014;//The highest year is 2014

int getYear(int count);

int binarySearch(int [],int,int);

void displayProd(char[][NAME_SIZE]);/////INCOMPLETE

int main()

{;

int yr[NUM_YEARS]={2001,2002,2003,2004,2005,2006,2007,2008,

2009,2010,2011,2012,2013,2014};

?

//MVP Names from 1999-2014

char names[NUM_YEARS][NAME_SIZE]=

{

"Allen Iverson",

"Tim Duncan",

"Tim Duncan",

"Kevin Garnett",

"Steve Nash",

"Steve Nash",

"Dirk Nowitzki",

"Kobe Bryant",

"LeBron James",

"LeBron James",

"Derrick Rose",

"LeBron James",

"LeBron James",

"Kevin Durant"

};

char description[NUM_YEARS][POINTS_GAME]=

{

"31.1",

"25.5",

"23.3",

"24.2",

"15.5",

"18.8",

"24.6",

"28.3",

"28.4",

"29.7",

"25.0",

"27.1",

"26.8",

"32.0"

};

int yrNum;

int index;

int index_2;

int c=0;

do

{

yrNum=getYear(c);

index=binarySearch(yr,NUM_YEARS,yrNum);

if(index==-1)

cout<<"That product number was not found.\n";

else

cout<<"Player: "<< names[index]<

cout<<"PPG: "<

c++;

}while(true);

system("pause");

system("cls");

return 0;

}

int getYear(int count)

{

int yearNum;

cout<<"Displays MVPs from 2000-2001 season to 2013-2014"<

cout<<"Example 2004-2005 season you would enter 2005."<

cout<<"Enter the year from the 2000-2001 season to 2013-2014: \n";

cout<<"Enter player "<<((count%2)+1)<

cin>>yearNum;

while(yearNumMAX_YEAR)

{

cout<<"Please enter between 2001 and 2014\n";

cin>>yearNum;

}

int t=0;

count=yearNum;

t=count;

return t;

?

}

int binarySearch(int array[], int numElems, int value)

{

int first = 0, // First array element

last = numElems-1, // Last array element

middle, // Mid point of search

position = -1; // Position of search value

bool found = false; // Flag

while (!found && first <= last)

{

middle = (first + last) / 2; // Calculate mid point

if (array[middle] == value) // If value is found at mid

{

found = true;

position = middle;

}

else if (array[middle] > value) // If value is in lower half

last = middle - 1;

else

first = middle + 1; // If value is in upper half

}

return position;

}

Displays MVPs from 2000-2001 season to 2013-2014
Example 2004-2005 season you would enter 2005.
Enter the year from the 2000-2001 season to 2013-2014:
Enter player 1
2001
Player: Allen Iverson
PPG: 31.1
Displays MVPs from 2000-2001 season to 2013-2014
Example 2004-2005 season you would enter 2005.
Enter the year from the 2000-2001 season to 2013-2014:
Enter player 2
2005
Player: Steve Nash
PPG: 15.5
Displays MVPs from 2000-2001 season to 2013-2014
Example 2004-2005 season you would enter 2005.
Enter the year from the 2000-2001 season to 2013-2014:
Enter player 1

HOW DO YOU GET IT LIKE THIS

Displays MVPs from 2000-2001 season to 2013-2014
Example 2004-2005 season you would enter 2005.
Enter the year from the 2000-2001 season to 2013-2014:

Displays MVPs from 2000-2001 season to 2013-2014

Enter the year from the 2000-2001 season to 2013-2014:
Enter player 1: 2001

Enter player 2: 2005

2001
Player: Allen Iverson PPG:

31.1

2005
Player: Steve Nash
PPG: 15.5

 

 

Reference no: EM13161439

Questions Cloud

Which of the folloiwing is not true of agonistic behavior : which of the folloiwing is not true of agonistic behavior?
Name two examples of biotechnology : Name two examples of biotechnology that use recombinant DNA technology and two examples that do not.
U.s. labor markets if immigration is not controlled : Immigration is a major topic of concern in today's economy. What are the possible problems and solutions for these concerns? What could happen to the U.S. labor markets if immigration is not controlled?
State equilibrium mixture of gases at a certain temperature : Ethylene, C2H4, and water react under appropriate conditions to give ethanol. The reaction is C2H4(g) + H2O(g) C2H5OH(g) An equilibrium mixture of these gases at a certain temperature
Const int num_years : How do you get this program to get both player input and then display results(As described on bottom) #include  const int NUM_YEARS=15;//The number of years const int NAME_SIZE=32;//The max size of the player name string
Which process produces the least quantity of atp : Which process produces the least quantity of ATP per molecule of glucose oxidized?
Displays columns titled "name", "quantity", "price", value : Write a program that displays columns titled "Name", "Quantity", "Price", and "Value". The fourth column contains the result of multiplying each item's quantity by its price. In addition, the program should calculate and display the total value of th..
State what is the partial pressure of h : Suppose it was found that in an equilibrium mixture of these gases the partial pressure of NH3(g) is 24.9 atm and the partial pressure of N2 is 6.68 atm. What is the partial pressure of H2(g)?
Which of the following is true of innate behavior : which of the following is true of innate behavior.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write function that randomly produces maze

Write a function mazeGenerator that randomly produces a maze (in C++). The Function should take as arguments a two-dimensional 12-by-12 character array.

  Smallest sequence of numbers in the array

Write a function called sum_smallest_sequence() that accepts an array of  signed  integers and the  number  of items in the array as arguments, and returns the sum of the smallest sequence of numbers in the array.

  The user enter the total rainfall for each of 12 months

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..

  Write program which inputs number of winning coupons

Write a program which inputs number of coupons you win and outputs how many candy bars and gumballs you can get if you spend all off your coupons on candy bars first and remaining coupons on gumballs in c++.

  Make a game in which you guess a number

Make a game in which you guess a number between two set numbers to find the answer, the game should tell you if you are too low in your guess or too high. For example

  Write a program in c that will find smallest value

Write a programe c that will find the smallest, largest and average values in a collection of N numbers.Get the value of N before scanning each value in the collection of N numbers.

  Insert the missing code in the c program

You are to insert the missing code in the C program given for combinational equivalence checking. This program will interface with the CUDD package and will parse netlist files in ISCAS85 circuit format. Next, BDDs will be created for each circuit an..

  Write a program to make the ssds function

Write a program to make the SSDs function as a MM:SS real-time clock. Hint: You must not use a single delay routine for the one second delay because that will not allow for persistence of vision. The displays need to be constantly refreshed during ev..

  Design and implement a library system

Design and implement a library system that does the following: ? Takes details of a student/library users: first name, last name, other names, user ID number, and nationality.

  Write a program that takes a positive integer

Write a program that takes a positive integer from the user and prints the rightmost digit of that integer. This is a sample output: Enter an integer: 1247

  C program to randomly generate more than ten ip address

Write C or C++ program which Randomly generates more than 10 IP addresses written in decimal format and write results in text file (e.g. Dec_IPAddresses.txt)

  Write application which ask user to input grades of students

Write C++ application which asks user to input grades for 5 student (3 grades each) save them in five double one dimensional arrays (one array for each student),

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd