alexey3017

пасс

Mar 20th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 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 ConsoleApp4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int tryCount = 3;
  14.             string password = "qwer";
  15.             string userInput;
  16.  
  17.             Console.WriteLine("Вам нужно угадать пароль что бы увидеть секретное сообщение");
  18.  
  19.             while (tryCount-- > 0)
  20.             {
  21.                 Console.Write("Введите пожалуйста пароль:");
  22.                 userInput = Console.ReadLine();
  23.  
  24.                 if(password == userInput)
  25.                 {
  26.                     Console.WriteLine("Вы видите секретное сообщение");
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.WriteLine("Вы ввели не правильный пароль, попробуйте еще раз");
  31.                 }
  32.             }
  33.             if(tryCount <=0)
  34.             {
  35.                 Console.WriteLine("Вы проиграли.");
  36.             }
  37.         }
  38.     }
  39. }
Add Comment
Please, Sign In to add comment