Mngaro Mwazenje

Mngaro Mwazenje

  • NA
  • 80
  • 13k

login credentials

Mar 17 2020 1:19 PM
i have the following code
how can i get the second user to login successfully
  1. public static void Main(string[] args)  
  2. {  
  3. string username = "alex";  
  4. string password = "sunshine";  
  5. string username2 = "emma";  
  6. string password2= "haskell";  
  7. Console.WriteLine("Enter username:");  
  8. string input = Console.ReadLine();  
  9. Console.WriteLine("Enter password:");  
  10. string input2 = Console.ReadLine();  
  11. if (username == input)  
  12. {  
  13. if (password == input2)  
  14. {  
  15. if (username2==input)  
  16. {  
  17. if (password2==input2)  
  18. {  
  19. Console.Write("You have successfully logged in!");  
  20. }  
  21. }  
  22. }  
  23. }  
  24. else  
  25. {  
  26. Console.Write("Incorrect username or password!");  
  27. }  

Answers (2)