Guest User

Untitled

a guest
Aug 17th, 2019
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. using System;
  3.  
  4. namespace ConsoleApp84
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string pass = "7A7";
  11. string getPassword = null;
  12.  
  13. byte numberAtempts = 5;
  14. byte numbeIncorrectAttempts = 0;
  15.  
  16. do
  17. {
  18. Console.WriteLine("Введите пароль: ");
  19. getPassword = Console.ReadLine();
  20.  
  21. if (pass != getPassword)
  22. {
  23. numbeIncorrectAttempts++;
  24. Console.ForegroundColor = ConsoleColor.Red;
  25. Console.WriteLine("Пароль не верный:");
  26. Console.ForegroundColor = ConsoleColor.Gray;
  27. Console.Write("У вас осталось ");
  28. Console.BackgroundColor = ConsoleColor.Red;
  29. Console.Write(numberAtempts - numbeIncorrectAttempts);
  30. Console.BackgroundColor = ConsoleColor.Black;
  31. Console.WriteLine(" попытки.");
  32. }
  33. else
  34. {
  35. Console.ForegroundColor = ConsoleColor.Yellow;
  36. Console.WriteLine("Добро пожаловать, вы ввели верный пароль !!!");
  37. Console.ForegroundColor = ConsoleColor.Gray;
  38. }
  39.  
  40. } while (pass != getPassword && numberAtempts != numbeIncorrectAttempts);
  41. }
  42. }
  43. }
RAW Paste Data