Pancake glutton program. (C++)
<p>Requires:
variables, data types, and numerical operators
basic input/output
logic (if statements, switch statements)
loops (for, while, do-while)
arrays</p>

<p>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)
Once the data has been entered the program must analyze the data and output which person ate the most pancakes for breakfast.</p>

<p>★ Modify the program so that it also outputs which person ate the least number of pancakes for breakfast.</p>

<p>★★★★ Modify the program so that it outputs a list in order of number of pancakes eaten of all 10 people.
i.e.
Person 4: ate 10 pancakes
Person 3: ate 7 pancakes
Person 8: ate 4 pancakes
...
Person 5: ate 0 pancakes</p>

<p>Current version I have written: <a href="http://codepad.org/QHnt11CT" rel="nofollow">http://codepad.org/QHnt11CT</a></p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;


void bubbleSort(int arr[], int n) {
      bool swapped = true;
      int j = 0;
      int tmp;
      while (swapped) {
            swapped = false;
            j++;
            for (int i = 0; i &lt; n - j; i++) {
                  if (arr[i] &gt; arr[i + 1]) {
                        tmp = arr[i];
                        arr[i] = arr[i + 1];
                        arr[i + 1] = tmp;
                        swapped = true;
                  }
            }
      }
}

int main()
{
    int pancakeAmount[10];
    std::string consumers[10];

    for (int i = 0, j = 1; i &lt; 10; i++, j++) {
        std::cout &lt;&lt; "Please enter an amount of pancakes eaten by consumer"\
        " number " &lt;&lt; j &lt;&lt; "." &lt;&lt; std::endl;
        std::cin &gt;&gt; pancakeAmount[i];
        std::cout &lt;&lt; "Please enter the name of the person who ate that amount"\
        " of pancakes." &lt;&lt; std::endl;
        getline(std::cin, consumers[i]);
    }

    std::cout &lt;&lt; "The results from least amount eaten to the greatest amount"\
    " eaten are as follows:" &lt;&lt; std::endl;

    bubbleSort(pancakeAmount, 10);

    for (int k = 0; k &lt; 10; k++) {
        std::cout &lt;&lt; pancakeAmount[k] &lt;&lt; std::endl;
    }

    return 0;
}
</code></pre>

<p>That is the problem I am currently working on. As of right now, the first two objectives of this problem have been solved without any notable issues. </p>

<p>The third objective, however, is proving to be a bit more difficult. I am having a hard time designing/implementing a sorted list with the appropriate labels. In line 47 I am trying to obtain a name or label to give to the corresponding amount. </p>

<p>I am running into an issue where the console will accept the amount I want to assign, but will completely ignore the call to the getline() function and loop back into asking for another amount. When the getline() function is called before the "std::cin >> pancakeAmount[i]" is called, I can give input on the first loop, but successive loops produce the error I was encountering when the getline() function was in it's original position in the code. </p>

<p>Am I trying to utilize an array of strings in an improper fashion, or is the getline() function not being used properly?</p>
