Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApp1;
- using System.Text;
- public class Task15
- {
- public void Run()
- {
- Console.InputEncoding = Encoding.Unicode;
- Console.OutputEncoding = Encoding.Unicode;
- string password = "Qwerty123";
- string secretPhrase = "My cat name is Koshka";
- int attempts = 3;
- bool isPasswordCorrect = false;
- while ( attempts > 0 && isPasswordCorrect == false )
- {
- attempts--;
- Console.WriteLine("Input password:");
- string inputPassword = Console.ReadLine();
- isPasswordCorrect = string.Equals( password, inputPassword );
- if(isPasswordCorrect)
- Console.WriteLine($"Password is correct, your secret : {secretPhrase}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement