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

  Describe the probability of the moves

Write a program in C++ to describe the Probability of the moves

  Write c program to read one ip address

Write a C or C++ program which Read one IP address at a time from Dec_IPAddresses.txt and convert it into Hex. Store converted values stored in another file (e.g. HEX_IPAddresses.txt).

  Program that stores a series of numbers in a binary tree

Write a program that stores a series of numbers in a binary tree

  Create a program for a company named retail-mart

Prompt the user to enter an item name (one word only), a quantity and a price. For this step, in addition to functionality, I'll be looking at: location of the variable declarations; appropriateness of data types selected; appropriateness of the va..

  Calculate the net pay as the gross less the taxes

Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference.

  Add 10 people to the line

Add 10 people to the line and process them. Each time you process someone, print out their ticket information. After all 10 have been serviced, print the average wait time. Below is an example of the time calls you will need and a wait function.

  What constructors do and when they are executed

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Write c program to add two integers and prints out average

Write a C program that prompts for a variable number of integers, adds them up, and prints out the average. The user will enter either an integer to be averaged.

  Create the appropriate constructor, getters and setters

Create the appropriate constructor, getters and setters for the class. Create an instance of Student for each of the students listed above from array. Construct the instance with lastname, firstname, and job.

  Prompts the user to enter an integer

Write the code that prompts the user to enter an integer between 1 and 20 (including 1 and 20), reads the value using cin, and then prints the value that they entered in a statement that begins with "You entered a ". Save this version in a separate l..

  Write a c function to convert gallons-quarts-pints and cups

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups.

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