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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
//THESE ARE MY RANDOM PANCAKE NUMBERS
// [0]='14',[1]='9',[2]='12',[3]='19',[4]='5',[5]='3',[6]='31',[7]='16',[8]='25',[9]='1'//
int person [10] = {1,2,3,4,5,6,7,8,9,10};
int maxNum = 0;
int a = 0;
int b = 1;
while (a <= 9)
{
cout << "Enter the number of pancakes eaten by Person "<< person [a] <<": ";
cin >> person [a];
a++;
system("cls");
//Try getting a better method than system("cls");
//cout << string(50, '\n');
}
system("Pause");
system("cls");
a = 1;
if (person [10] >= 0)
while(a <= 10)
{
cout << "Person "<< a <<" is: " << person [a-1] << endl;
a+=1;
}
system("Pause");
//Look into the input buffer! makes cin.ignore work bad!
//cin.ignore();
system("cls");
// [0]='14',[1]='9',[2]='12',[3]='19',[4]='5',[5]='3',[6]='31',[7]='16',[8]='25',[9]='1'//
a = 0;
b = 1;
do
{
if (person [a] > person [b])
{
maxNum = person [a];
b++;
}
else if (person [b] > person [a])
{
maxNum = person [b];
a++;
}
else if (person [a] == person [b])
a++;
} while (a <= 9);
cout << "The most pies eaten were: " << maxNum;
return 0;
}
|