Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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 ExercisesProject.Exercises
  8. {
  9. class Password
  10. {
  11. public static void Main()
  12. {
  13. int user, pass;
  14. int counter = 0;
  15. do
  16. {
  17. Console.Write("Enter a user :");
  18. user = Convert.ToInt32(Console.ReadLine());
  19.  
  20. Console.Write("Enter a password :");
  21. pass = Convert.ToInt32(Console.ReadLine());
  22.  
  23. if ((user != 12 || (pass != 1234)))
  24. {
  25. Console.Write("Login Error");
  26. counter++;
  27. }
  28.  
  29. }
  30. while ((user != 12 || (pass != 1234)) && (counter != 3));
  31.  
  32. if ((user != 12 || (pass != 1234)))
  33. Console.WriteLine("Logged Out");
  34.  
  35. else
  36. Console.WriteLine("Login successful");
  37. }
  38.  
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement