Advertisement
Dr_Max_Experience

Task 13

Aug 14th, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 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 Homework_1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string password = "qwerty";
  14.             string mail = "Secret: there is no secret :)";
  15.             string userInput = "";
  16.             int attempt;
  17.             for (attempt = 3;  attempt > 0 && userInput != "exit" && userInput != password; attempt--)
  18.             {
  19.                 Console.Clear();        
  20.                 Console.Write($"Осталось попыток: {attempt}\nВведите пароль: ");
  21.                 userInput = Console.ReadLine();
  22.                 if (userInput != password && userInput != "exit")
  23.                 {
  24.                     Console.WriteLine("Ошибка! Неправильный пароль!");
  25.                     Console.ReadKey();
  26.                 }
  27.                 if (userInput == password)
  28.                 {
  29.                     Console.WriteLine(mail);
  30.                 }
  31.             }
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement