title: Displaying Result of two compared arrays
body: <p>Maybe I just need to step away but I have been staring at this code and I cannot figure out what I need to do. I am comparing submitted responses (in a text file), against an answer key (separate text file) that have been written into arrays. I have used a for loop to compare the arrays and I have the count of how many correct answers and incorrect answers.</p>
  <p>I'm trying to display the specific question numbers (index number) of the submitted responses that are incorrect in a label. I have tried a for loop, a foreach, and various methods with strings and arrays. I'm not sure if the problem is in the original for loop that is comparing the arrays or if it has to with the way I am trying to display the string with concatenation. Sorry if the answer is staring me in the face and I am missing it.</p>
  <pre><code>private void buttonGrade_Click(object sender, EventArgs e)
          {
              string[] correct = new string[20];
              string[] wrong = new string[20];
              string[] result = new string[20];
  
              string corAns = &quot;&quot;;
              string incorAns = &quot;&quot;;
  
              StreamReader inputFile;
              StreamReader staticFile;
              inputFile = File.OpenText(&quot;Response.txt&quot;);
              staticFile = File.OpenText(&quot;Answers.txt&quot;);
              int count = 0;
              string response = &quot;&quot;;
              string answers = &quot;&quot;;
                          
              
  
              int strAcount = 0; //Counter for correct answers
              int strRcount = 0; //Counter for incorrect answers
             
              while (inputFile.EndOfStream == false &amp;&amp; staticFile.EndOfStream == false)
              {
                  response = inputFile.ReadLine();
                  answers = staticFile.ReadLine();
                  correct[count] = response;
                  wrong[count] = answers;
                  count++;
              }
  
  
              for (int j = 0; j &lt; correct.Length; j++)
              {
                  if (correct[j] == wrong[j])
                  {
  
                      corAns += 1;
                      strAcount = corAns.Length;
                  }
                  else
                  {
                      incorAns += 1;
                      strRcount = incorAns.Length;
                  }
              }
  
              if (strAcount &gt; 14)
              {
                  labelOutputpassfail.Text = &quot;Pass&quot;;
              }
              else
              {
                  labelOutputpassfail.Text = &quot;Fail&quot;;
              }
  
              inputFile.Close();
              staticFile.Close();
  
              string myString = &quot;#s - &quot;;
              for (int i = 0; i &lt; 20; i += strRcount)
              {
                  myString += incorAns.ToString() + &quot;, &quot;;
              }
              labelOutputmissed.Text = myString;
              
              labelOutputcorrect.Text = strAcount.ToString();
              labelOutputincorrect.Text = strRcount.ToString();
  
              
             
          }   
  </code></pre>