Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 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. public class Login
  8. {
  9.     public static void Main()
  10.     {
  11.         string userid, password;
  12.         int tries_left = 0, tri = 0;
  13.         Console.Write("\n Check Login :\n");
  14.  
  15.         Console.Write("\nDefault ID : admin , Password : pass \n\n");
  16.         do
  17.         {
  18.             Console.Write("input userid :");
  19.             userid = Console.ReadLine();
  20.             Console.Write("input password :");
  21.             password = Console.ReadLine();
  22.  
  23.             if (userid == "admin" && password == "pass")
  24.             {
  25.                 tri = 1;
  26.                 tries_left = 0;
  27.             }
  28.             else
  29.             {
  30.                 tri = 0;
  31.                 tries_left++;
  32.             }
  33.         }
  34.         while ((userid != "admin" || password != "pass")
  35.        && (tries_left != 3));
  36.             if (tri == 0)
  37.             {
  38.                 Console.Write("No Remaining Tries\n");
  39.             Console.ReadKey();
  40.         }
  41.             else {
  42.                 if (tri == 1)
  43.                 {
  44.                     Console.Write("Logged in ! \n");
  45.                 Console.ReadKey();
  46.             }
  47.  
  48.             }
  49.         }
  50.  
  51.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement