1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
//Pancake Glutton
#include <iostream>
int main()
{
using namespace std;
int pmax, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, i;
int NumberOfPancakes[1][10] = {p1, p2, p3, p4, p5, p6, p7, p8, p9, p10};
int MaxPancakes[1][1] = {pmax};
int j = 1, k = 0;
for (i = 1; i < 11; i++)
{
cout << "How many Pancakes did person " << i << " eat?\n";
cout << "Number of Pancakes: ";
cin >> NumberOfPancakes[0][i];
cout << endl;
}
for (i = 0; i < 11; i++)
{
if (NumberOfPancakes[0][i] > NumberOfPancakes[0][j])
{
pmax = NumberOfPancakes[0][i];
k = i;
j++;
}
}
cout << "The max number of pancakes eaten was " << pmax << ".\n";
cout << "The " << pmax << " pancakes were eaten by person number " << k << ".\n";
char response;
cin >> response;
return 0;
}
|