#include <iostream>
#include <algorithm>
using namespace std;
void getPancakesEaten(int pancakes[10]);
void displayOrder(int pancakes[10]);
/**********************************************************************
* Gets the amount of Pancakes eaten
***********************************************************************/
void getPancakesEaten(int pancakes[10])
{
for(int i = 0; i < 10; i++)
{
//cout << "Person " << i + 1 << ": ate ";
cin >> pancakes[i];
}
cout << endl;
}
/**********************************************************************
* Displays the order in which person ate the most pancakes to the least
***********************************************************************/
void displayOrder(int pancakes[10])
{
int order[10];
for (int i = 0; i < 10; ++i)
order[i] = i;
sort(order, order+10, [&pancakes](int a, int b){ return pancakes[a] > pancakes[b]; });
for(int i = 0; i < 10; ++i)
cout << "Person " << order[i] + 1 << ": ate " << pancakes[order[i]] << " pancake(s)" << endl;
}
/**********************************************************************
* Runs the Entire Program
***********************************************************************/
int main()
{
int pancakes[10];
getPancakesEaten(pancakes);
displayOrder(pancakes);
return 0;
}