SHARE
TWEET

Untitled

a guest Mar 19th, 2017 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace BaseClassLibrary
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int id = 59943;                          //Assuming a user id
  10.             string password = "Kiss4Love!";          //Assuming a password
  11.            
  12.             int attempt = 0;
  13.  
  14.             int userid;
  15.             string pass;
  16.             do
  17.             {
  18.                 Console.WriteLine("Username: ");
  19.                 userid = Convert.ToInt32(Console.ReadLine());
  20.  
  21.                 Console.WriteLine("Password: ");
  22.                 pass = Convert.ToString(Console.ReadLine());
  23.  
  24.                 if (userid == id && pass == password)
  25.                 {
  26.                     Console.WriteLine("Login Successful!!");
  27.                     Console.ReadKey();
  28.                     return;
  29.                 }
  30.                 else
  31.                 {
  32.                     Console.WriteLine("Wrong Credintials! Try again!");
  33.                     attempt++;
  34.                 }
  35.             } while (attempt < 3);
  36.  
  37.             Console.WriteLine("You had your maximum attempts!");
  38.             Console.ReadKey();
  39.         }
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top