Well, I'm trying to make this program but its giving me a hard time. Can anyone please make this so that i could understand it. Then I will make it from scratch again. It is one of the practice exercises on the site.
Once the data has been entered the program must analyze the data and output which person ate the most pancakes for breakfast.
★ Modify the program so that it also outputs which person ate the least number of pancakes for breakfast.
★★★★ Modify the program so that it outputs a list in order of number of pancakes eaten of all 10 people.
i.e.
Person 4: ate 10 pancakes
Person 3: ate 7 pancakes
Person 8: ate 4 pancakes
...
Person 5: ate 0 pancakes
//Ok so I made this now. Still working on it. but I'm stuck now.I don't know //how to make the program use the values of 'y' I entered in the list.
//It only shows the last value of 'y' I entered in the list.
you need 'y' to be a vector or an array. You can NOT input multiple values into an integer alone. Each iteration of you for loop changes the value of 'y'. Try:
1 2 3 4 5 6 7 8 9 10
constint MAX = 10;
int y[MAX];
//now in your for loop to enter the values for each element of 'y' use
cin >> y[x];
//but you also need to start the value of x in your for loop to 0
//when you want to output 1 when x = 0 just output x+1