How would I go about listing the numbers wrong that test takers took in this program?
<p>I am making a program that compares student answers with the right answers, the program eventually outputs whether the student passed, the right and wrong answers, and then list the numbers that the students got wrong. I got everything except listing the numbers wrong part. I am having a massive brain fart so any help would be nice</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;fstream&gt;
using namespace std;

int main ()
{
  ifstream fp;
  fp.open ("driving.dat");
if(!fp)
{
  cout&lt;&lt;"Error opening file\n";
  return 0;
}
  cout&lt;&lt;"Passed"&lt;&lt;setw(10)&lt;&lt;"Correct" &lt;&lt;setw(10)&lt;&lt;"Wrong" &lt;&lt;setw(20)&lt;&lt;"Numbers Wrong&lt;&lt;endl;
  cout&lt;&lt;"---------------------------------------------------------------------------" &lt;&lt;endl;

   while(fp.eof()==false)
  {
  char student[20], ;
  for (int i=0; i&lt;20; i++)
    {
      fp&gt;&gt;student[i];
    }
  char correct[20]={'B', 'D', 'A', 'A', 'C', 'A', 'B', 'A', 'C', 'D', 'B', 'C', 'D', 'A', 'D', 'C', 'C', 'B', 'D', 'A'};
  bool studentgrade[20];
  for(int i=0; i&lt;20; i++)
    {
      if(student[i]==correct[i])
        studentgrade[i]=true;
      else
        studentgrade[i]=false;
    }
  int counter=0;
  int wrong=0, right=0,list=0;
  for (int i=0; i&lt;20; i++)
    {
      if(studentgrade[i]==true)
        counter++, right++;
      else
        wrong++;

    }

   if (counter&gt;=15)
    cout&lt;&lt;"Yes" &lt;&lt;setw(10)&lt;&lt;right&lt;&lt;setw(13)&lt;&lt;wrong&lt;&lt;endl;
  else
    cout&lt;&lt;"No " &lt;&lt;setw(10)&lt;&lt;right&lt;&lt;setw(13)&lt;&lt;wrong&lt;&lt;setw(10);
  for (int i=0; i&lt;20 &amp;&amp; wrongAnswers[i];i++)
    {
      if(i!=0)cout&lt;&lt;", ";
      cout&lt;&lt;wrongAnswers[i];
    }
  cout&lt;&lt;endl;

return 0;

}
</code></pre>

<h2>output</h2>

<pre><code>Passed   Correct     Wrong       Numbers Wrong
---------------------------------------------------------------------------
No         14            6            2, 6, 9, 10, 19, 20
Yes        20            0
          Yes        17            3            2, 6, 15
Yes        15            5            1, 2, 7, 10, 15
No          1           19            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20
Yes        19            1            7
Yes        18            2            9, 10
Yes        18            2            9, 10
</code></pre>
