title: comparing elements of an array in c++
body: <p>We have a project that simulate the function of an atm. the user must enter a pincode and it will be masked with an asterisk. the input pincode must be equal to the default pincode that is stored in an array. My program can masked the input pincode with an asterisks, the only problem is that even if the input pincode is the same with the default pincode, it still output incorrect. what must be the problem? here is my code:</p>
  
  <pre><code>void checkPword()
  {
      char defaultPin[4] = "1234";
      char inputPin[4] = "";
  
      clrscr();
      for (int cnt = 0; cnt &lt;= 3; cnt++)
      {
          cout &lt;&lt; "*";
          inputPin[ctr];
      }
      if (defaultPin[0] == inputPin[0] &amp;&amp; defaultPin[1] == inputPin[1]
          &amp;&amp; defaultPin[2] == inputPin[2] &amp;&amp; defaultPin[3] == inputPin[3])
      {
          clrscr();
          cout &lt;&lt; "pincode is correct"; 
      }
      else
      {
          clrscr();
          cout &lt;&lt; "pincode is incorrect";
      }
  }
  </code></pre>