#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,i,j,k;
cout<<"User 1, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>a;
cout<<"User 2, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>b;
cout<<"User 3, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>c;
cout<<"User 4, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>d;
cout<<"User 5, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>e;
cout<<"User 6, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>f;
cout<<"User 7, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>g;
cout<<"User 8, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>h;
cout<<"User 9, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>i;
cout<<"User 10, enter the numnber of pancakes you ate this morning for breakfast!";
cin>>j;
int users[10]={a,b,c,d,e,f,g,h,i,j};
sort(users, users+10);
if (a==users[9])
cout<<"Winner for the most pancakes is User 1"<<endl;
if(b==users[9])
cout<<"Winner for the most pancakes is User 2"<<endl;
if(c==users[9])
cout<<"Winner for the most pancakes is User 3"<<endl;
if(d==users[9])
cout<<"Winner for the most pancakes is User 4"<<endl;
if(e==users[9])
cout<<"Winner for the most pancakes is User 5"<<endl;
if(f==users[9])
cout<<"Winner for the most pancakes is User 6"<<endl;
if(g==users[9])
cout<<"Winner for the most pancakes is User 7"<<endl;
if(h==users[9])
cout<<"Winner for the most pancakes is User 8"<<endl;
if(i==users[9])
cout<<"Winner for the most pancakes is User 9"<<endl;
if(j==users[9])
cout<<"Winner for the most pancakes is User 10"<<endl;
if (a==users[0])
cout<<"Winner for the least pancakes is User 1"<<endl;
if(b==users[0])
cout<<"Winner for the least pancakes is User 2"<<endl;
if(c==users[0])
cout<<"Winner for the least pancakes is User 3"<<endl;
if(d==users[0])
cout<<"Winner for the least pancakes is User 4"<<endl;
if(e==users[0])
cout<<"Winner for the least pancakes is User 5"<<endl;
if(f==users[0])
cout<<"Winner for the least pancakes is User 6"<<endl;
if(g==users[0])
cout<<"Winner for the least pancakes is User 7"<<endl;
if(h==users[0])
cout<<"Winner for the least pancakes is User 8"<<endl;
if(i==users[0])
cout<<"Winner for the least pancakes is User 9"<<endl;
if(j==users[0])
cout<<"Winner for the least pancakes is User 10"<<endl;
cout<<"thankyou";
cin>>k;
return 0;
}
There has got to be a more simple way of accomplishing this. Thoughts and suggestions welcome.
ignore the cin>>k; at the end it just gives the program a pause before exiting lol

New Topic/Question
Reply




MultiQuote






|