Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 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 DemoProgram1HelloWorld {
  8.   class Program {
  9.     static void Main(string[] args) {
  10.  
  11.       string username;
  12.       string password;
  13.       bool loggedin = false;
  14.  
  15.       while(!loggedin) {
  16.         Console.Write("Enter username: ");//asks for username and stores it to variable "username"
  17.         username=Console.ReadLine();
  18.  
  19.         Console.Write("Enter password: ");//requests password
  20.         password=Console.ReadLine();
  21.  
  22.         if(username=="Bioniclegenius"&&password=="blaarg") {
  23.           Console.WriteLine("Login was successful!");
  24.           loggedin=true;
  25.         }
  26.         else if(username!="Bioniclegenius") {
  27.           Console.WriteLine("Invalid username.");
  28.         }
  29.         else {
  30.           Console.WriteLine("Invalid password.");
  31.         }
  32.       }
  33.     }
  34.   }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement