Okay I got it to work but it isnt working in the right way. Here is the code i think is relevant:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
int temp;
for( int i = 0; i < (11 - 1); i++ )
{
for( int j = (i+1); j < 11; j++ )
{
if( people[i] < people[j] )
{
temp = people[i];
people[i] = people[j];
people[j] = temp;
}
}
}
for( int i = 0; i < 11; i++ )
{
cout << "Person " << i << ": ate " << people[i] << " pancakes." << endl;
}
Here is the input/output:
1 2 3 4 5 6 7 8 9
Enter how many pancakes each person ate.
Person 0 ate: 5
Person 4 ate: 2
Person 7 ate: 1
(here is the output...)
Person 0: ate 11 pancakes.
Person 4: ate 5 pancakes.
Person 7: ate 3 pancakes.
That isnt the output exactly i obviously skipped some but the point is I input that person 0 ate 5, and it outputted that 0 ate 11. The amount of pancakes is in order, but they arent with the right people.