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 Программа_под_паролем
- {
- class Program
- {
- static void Main(string[] args)
- {
- int i = 5;
- string Password = "Qw123456";
- string Pas = "";
- while (i != 0)
- {
- Console.WriteLine("Введите пароль");
- while (true)
- {
- ConsoleKeyInfo CharKey = Console.ReadKey(true);
- if (CharKey.Key == ConsoleKey.Enter)
- {
- Console.Write("\n");
- break;
- }
- else if (CharKey.Key == ConsoleKey.Backspace)
- {
- Pas = Pas.Remove(Pas.Length - 1);
- Console.Write("\b \b");
- }
- else
- {
- Pas += CharKey.KeyChar;
- Console.Write("*");
- }
- }
- if (Password == Pas)
- {
- Console.Clear();
- Console.Write("Пароль Верен!");
- Console.ReadKey();
- Console.Write("Красава! ^_^\n");
- Console.ReadKey();
- return;
- }
- else
- {
- Console.Clear();
- Console.WriteLine("Не верный пароль!");
- i--;
- Console.WriteLine($"Попыток осталось {i}");
- Console.ReadKey();
- }
- }
- Console.WriteLine(Password);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement