Advertisement
Guest User

8

a guest
Jan 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 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 ConsoleApp5
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Здравствуйте, вам пришло секретное сообщение. Для того что бы его увидеть введите пароль: ");
  14.             for(int i = 0; i != 5; i++)
  15.             {
  16.                 Console.ForegroundColor = ConsoleColor.Red;
  17.                 Console.BackgroundColor = ConsoleColor.Red;
  18.                 string pass = Console.ReadLine();
  19.                 Console.ForegroundColor = ConsoleColor.Gray;
  20.                 Console.BackgroundColor = ConsoleColor.Black;
  21.                 if (pass == "csharp")
  22.                 {
  23.                     Console.WriteLine("Вы выиграли автомобиль, что бы его получить отправьте 100$ на номер 999999999 ");
  24.                     break;
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.Write("Пароль не верный, у вас осталось {0} попытки, попробуйте еще раз: ", 4 - i);
  29.                 }                
  30.                 if (i == 4)
  31.                 {
  32.                     return;
  33.                 }
  34.             }
  35.             Console.ReadKey();
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement