title: How to compare 2 character strings?
body: <p>I am making a typing game and I need to compare a generated string and input string character by character to and then calculate % accuracy. </p>
  
  <p>But it seems am missing something because the function does no compare well. </p>
  
  <p>Am I doing something wrong ? </p>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
      {
          int percentage = 0;
          int mistakes = 0;
          string input = TextBox1.Text;
  
          string letter = TextBox2.Text;
          char[] letters1 = letter.ToCharArray();
          char[] input1 = input.ToCharArray();
  
          for (int j = 0; j &lt; input1.Length; j++)
          {
              if (input1[j] != letters1[j])
                  mistakes = mistakes +1;   
  
              else if (input1[j] == letters1[j])
                  mistakes = mistakes;
          }
  
          percentage = 100 - ((mistakes / letters1.Length) * 100);
          Label2.Content = percentage;
  
  
      }
  </code></pre>