Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. // data variables
  14. string username = "john";
  15. string password = "doe";
  16. // keyboard input
  17. string user = "";
  18. string pass = "";
  19.  
  20. do {
  21.  
  22. Console.WriteLine("Please enter username:");
  23. user = Console.ReadLine();
  24. Console.WriteLine("Please enter password:");
  25. pass = Console.ReadLine();
  26.  
  27. if (user == username) {
  28. if (pass == password)
  29. {
  30. Console.WriteLine("Welcome to our system!");
  31.  
  32. }
  33. else
  34. {
  35. Console.WriteLine("Invalid password");
  36. }
  37. }
  38. else
  39. {
  40. Console.WriteLine("No such user found!");
  41. }
  42. } while (username != user || password != pass);
  43.  
  44.  
  45. Console.ReadKey();
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement