Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 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 ConsoleApplication3
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. /*
  14. string[] weekdays = new string[7];
  15. // string[] week = new string[] { "Sunday", "Monday", "Tuesday" };
  16. weekdays[0] = "monday";
  17. weekdays[1] = "tuesday";
  18. weekdays[2] = "wednesday";
  19. weekdays[3] = "thursday";
  20. weekdays[4] = "friday";
  21. weekdays[5] = "saturday";
  22. weekdays[6] = "sunday";
  23.  
  24. for (int i = 0; i < weekdays.Length; i++)
  25. {
  26. Console.WriteLine(weekdays[i]);
  27. }
  28. */
  29.  
  30. // default data
  31. string systemUsername = "john";
  32. string[] systemUsernames = new string[] { "user1", "user2" };
  33. string systemPassword = "doe";
  34. string[] systemPasswords = new string[] { "asdasd", "qweqwe" };
  35.  
  36. string username = "";
  37. string password = "";
  38. bool validCredentials = false;
  39.  
  40. // Welcome screen
  41. Console.WriteLine("Welcome to our system");
  42.  
  43. while (validCredentials == false)
  44. {
  45. Console.WriteLine("Enter username:");
  46. username = Console.ReadLine();
  47. Console.WriteLine("Enter password:");
  48. password = Console.ReadLine();
  49.  
  50. for (int i = 0; i < systemUsernames.Length; i++)
  51. {
  52.  
  53. if (username == systemUsernames[i])
  54. {
  55. if (password == systemPasswords[i])
  56. {
  57. validCredentials = true;
  58. Console.WriteLine("Welcome to the system!");
  59. }
  60. else
  61. {
  62. Console.WriteLine("Incorrect password!");
  63. }
  64. }
  65. }
  66. }
  67.  
  68. // system pause // press key to exit
  69. Console.ReadKey();
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement