Advertisement
Guest User

C# Login/Password System

a guest
Jul 20th, 2016
1,707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;  
  2. public class Login1  
  3. {  
  4. public static void Main()  
  5. {  
  6. string username, password;  
  7. int ctr = 0;  
  8.        Console.Write("\n\nCheck username and password :\n");  
  9.        Console.Write("N.B. : Default username and password is : username and password\n");  
  10.        Console.Write("---------------------------------\n");  
  11. do  
  12. {  
  13. Console.Write("Input a username: ");  
  14. username = Console.ReadLine();  
  15.    
  16. Console.Write("Input a password: ");  
  17. password = Console.ReadLine();  
  18.  
  19. ctr++;  
  20. }  
  21. while (( username != "username" && password != "password" )  
  22.         && (ctr != 3));  
  23.          
  24.         if (ctr == 3)  
  25.             Console.Write("\nLogin attempt more than three times. Try later!\n\n");  
  26.         else    
  27.             Console.Write("\nPassword entered successfull!\n\n");        
  28.    
  29.     }  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement