Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Homework_1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string password = "qwerty";
- string mail = "Secret: there is no secret :)";
- string userInput = "";
- int attempt;
- for (attempt = 3; attempt > 0 && userInput != "exit" && userInput != password; attempt--)
- {
- Console.Clear();
- Console.Write($"Осталось попыток: {attempt}\nВведите пароль: ");
- userInput = Console.ReadLine();
- if (userInput != password && userInput != "exit")
- {
- Console.WriteLine("Ошибка! Неправильный пароль!");
- Console.ReadKey();
- }
- if (userInput == password)
- {
- Console.WriteLine(mail);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement