title: login with Do..while loop in C
body: <p>I need to make a program that asks for a username and password and if they are both correct continue to a menu.
  Currently inputting a <strong>correct</strong> username and <strong>wrong</strong> password for some reason still prompts me to the menu, however if i input a <strong>wrong</strong> username and <strong>correct</strong> password it doesn't .Also if i enter correct username and password from the first try, it always returns "Wrong username or password try again".Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #define user "kaiti"
  #define pass "123Pass!"        
  int main()
  {
      char username[20], password[20];
  
      //-----LOGIN PHASE-----
      printf("Please Enter username:");
      scanf("%s", &amp;username);
  
      printf("\nPlease enter password:");
      scanf("%s", &amp;password);
      do
      {
  
          printf("Wrong username or password try again!\n");
  
          printf("\nPlease Enter username:");
          scanf("%s", &amp;username);
  
          printf("\nPlease enter password:");
          scanf("%s", &amp;password);
  
      }
      while (strcmp(username, user) != 0 &amp;&amp; strcmp(password, pass) != 0);
  
      printf("Correct username and password.\n\nWelcome Mrs.Kaiti!\n\nWhat would you like to do?");
      //-----END OF LOGIN PHASE-----
  </code></pre>