Vapio

task12

Mar 6th, 2021 (edited)
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         string password = "1337Bruh228";
  8.         string secretMessage = "Secret message without swearing.";
  9.         int tryCount = 3;
  10.        
  11.         string input = "";
  12.        
  13.         for (int i = 0; i < tryCount; ++i)
  14.         {
  15.             Console.WriteLine("Please input a password : ");
  16.             input = Console.ReadLine();
  17.  
  18.             if (input.Equals(password))
  19.             {
  20.                 Console.WriteLine("Your secret message is : " + secretMessage);
  21.                 i = tryCount;
  22.             }
  23.             else if (i + 1 == tryCount)
  24.             {
  25.                 Console.WriteLine("Count of error tries is out of limit.");
  26.             }
  27.         }
  28.     }
  29. }
Add Comment
Please, Sign In to add comment