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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
#include<iostream>
using namespace std;
int main() {
int temp = 0;
int sitrep = 1;
int person [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [1];
sitrep++;
}
while (sitrep == 1);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [2];
sitrep++;
}
while (sitrep == 2);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [3];
sitrep++;
}
while (sitrep == 3);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [4];
sitrep++;
}
while (sitrep == 4);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [5];
sitrep++;
}
while (sitrep == 5);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [6];
sitrep++;
}
while (sitrep == 6);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [7];
sitrep++;
}
while (sitrep == 7);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [8];
sitrep++;
}
while (sitrep == 8);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [9];
sitrep++;
}
while (sitrep == 9);
do {
cout << "Enter how many pancakes person " << sitrep << " ate." << endl;
cin >> person [10];
sitrep++;
}
while (sitrep == 10);
while (person [1] > person [2],person [1] > person [3],person [1] > person [4],person [1] > person [5], // Checks if person [1] is the largest value in the person array.
person [1] > person [6],person [1] > person [7],person [1] > person [8],person [1] > person [9], person [1] > person [10]) {
cout << "The person that ate the most pancakes is " << "person 1!" << endl; }
while (person [2] > person [1],person [2] > person [3],person [2] > person [4],person [2] > person [5], // Checks if person [2] is the largeset value in the person array.
person [2] > person [6],person [2] > person [7],person [2] > person [8],person [2] > person [9], person [2] > person [10]) {
cout << "The person that ate the most pancakes is " << "person 2!" << endl;
while (person [3] > person [2],person [3] > person [1],person [3] > person [4],person [3] > person [5], // Checks if person [3] is the largest value in the person array.
person [3] > person [6],person [3] > person [7],person [3] > person [8],person [3] > person [9], person [3] > person [10]){
cout << "The person that ate the most pancakes is " << "person 3!" << endl; }
while (person [4] > person [2],person [4] > person [1],person [4] > person [3],person [4] > person [5], // Checks if person [4] is the largest value in the person array.
person [4] > person [6],person [4] > person [7],person [4] > person [8],person [4] > person [9], person [4] > person [10]) {
cout << "The person that ate the most pancakes is " << "person 4!" << endl; }
while (person [5] > person [2],person [5] > person [1],person [5] > person [3],person [5] > person [4], // Checks if person [5] is the largest value in the person array.
person [5] > person [6],person [5] > person [7],person [5] > person [8],person [5] > person [9], person [5] > person [10]){
cout << "The person that ate the most pancakes is " << "person 5!" << endl; }
while (person [6] > person [2],person [6] > person [3],person [6] > person [4],person [6] > person [5], // Checks if person [6] is the largest value in the person array.
person [6] > person [1],person [6] > person [7],person [6] > person [8],person [6] > person [9], person [6] > person [10]){
cout << "The person that ate the most pancakes is " << "person 6!" << endl; }
while (person [7] > person [1],person [7] > person [3],person [7] > person [4],person [7] > person [5], // Checks if person [7] is the largeset value in the person array.
person [7] > person [6],person [7] > person [2],person [7] > person [8],person [7] > person [9], person [7] > person [10]) {
cout << "The person that ate the most pancakes is " << "person 7!" << endl; }
while (person [8] > person [2],person [8] > person [1],person [8] > person [4],person [8] > person [5], // Checks if person [8] is the largest value in the person array.
person [8] > person [6],person [8] > person [7],person [8] > person [3],person [8] > person [9], person [8] > person [10]){
cout << "The person that ate the most pancakes is " << "person 8!" << endl; }
while (person [9] > person [2],person [9] > person [1],person [9] > person [3],person [9] > person [5], // Checks if person [9] is the largest value in the person array.
person [9] > person [6],person [9] > person [7],person [9] > person [8],person [9] > person [4], person [9] > person [10]){
cout << "The person that ate the most pancakes is " << "person 9!" << endl; }
while (person [10] > person [2],person [10] > person [1],person [10] > person [3],person [10] > person [4], // Checks if person [10] is the largest value in the person array.
person [10] > person [6],person [10] > person [7],person [10] > person [8],person [10] > person [9], person [10] > person [5]){
cout << "The person that ate the most pancakes is " << "person 10!" << endl; }
}
system("pause");
return 0;
}
|