I was searching for an exercise and was wondering how am I gonna do this?
Write a program that asks the user to enter the number of pancakes eaten for breakfast by 10 different people (Person 1, Person 2, ..., Person 10)
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
string names[10]={};
int numberOfPancakesEaten[10]={};
void pancakesEaten(){
cout << "Hello! Please enter 10 persons with how many pancakes they've eaten for breakfast." << endl;
cout << "Name Pancakes\n" << endl;
Unfortunately, plain C arrays don't have built-in methods like max(), min(), etc. One approach would be to actually determine the max/min values as you process the user's input. Another way is to use std::vector, then sort it using std::sort.