#include<stdio.h>
#include<iostream>
usingnamespace std;
int main(){
int a[10];
//Enter 10 persons
for (int x=0; x<10; x++)
cout<<"Person #:"<<endl;
// read the values;
{
for (int i=0; i<10; i++)
cin >> a[i];
}
// the loop
int max = a[0];
for (int i=1; i<10; i++)
if (a[i] > max) max = a[i];
// print the result
cout << "The largest number is " << max<<endl;
system("pause");
}
the output should be like
// input
Person 3: //input number of cakes
//input
Person 9: // input number of cakes
up to 10 persons and then the program outputs the # of the Person and the # of cakes he ate...
"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)"
For this, you should have an array ready with 10 different indices, and then you should have a for loop that loops from 0 to 9. You would then output Person, followed by i+1, followed by a colon (:) and a space. Then you input to array index i.