Advertisement
AlexeySudakov

Untitled

Aug 8th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2. using System.Threading.Tasks;
  3. using System.Threading;
  4.  
  5. namespace light
  6. {
  7.     class MainClass
  8.     {
  9.         public static void Main(string[] args)
  10.         {
  11.            
  12.              int count = 0;
  13.              Console.WriteLine("Введите пароль");
  14.              string p = Console.ReadLine();
  15.              while (p != "1234")
  16.              {
  17.                  Console.WriteLine("Вы ввели не правильный пароль");
  18.                  p = Console.ReadLine();
  19.                  count++;
  20.                  if (count >= 4)
  21.                  {
  22.                      Console.WriteLine("Превышенно количество попыток");
  23.                      break;
  24.                  }
  25.              }
  26.              if (p == "1234")
  27.              {
  28.                  Console.WriteLine("Secret message");    
  29.              }
  30.  
  31.  
  32.             int count = 0;
  33.             string p = "";
  34.             while ((p = Console.ReadLine()) != "1234")
  35.             {
  36.                 count++;
  37.                 Console.WriteLine("Пароль введён не верно");
  38.                 if (count>=5)
  39.                 {
  40.                     Console.WriteLine("Превышенно количество попыток");
  41.                     break;
  42.                 }
  43.             }
  44.             if (p == "1234")
  45.             {
  46.                 Console.WriteLine("It's a secret message");
  47.             }
  48.  
  49.  
  50.             int count = 0;
  51.             while (count<5)
  52.             {
  53.                
  54.                 string _p = Console.ReadLine();
  55.                 if (_p == "1234")
  56.                 {
  57.                     break;
  58.                 }
  59.                 else
  60.                 {
  61.                     count++;
  62.                     Console.WriteLine("Вы ввели не правильный пароль");
  63.                 }  
  64.             }
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement