Login

 using System;

using System.IO;

using System.Linq;

using System.Collections.Generic;

namespace CSharp_Shell

{

 public class Program

 {

  public static void Main()

  {

   Console.WriteLine("Create new account");

   Console.WriteLine("Enter new user name");

   string name = Console.ReadLine();

   Console.WriteLine("Enter new password");

   string password = Console.ReadLine();

   Console.WriteLine("\nLogin");

   Console.WriteLine("Enter user name");

   string nameInput = Console.ReadLine();

   Console.WriteLine("Enter password");

   string passwordInput = Console.ReadLine();

   CheckLogin(name, password, nameInput, passwordInput);

  }

  public static void CheckLogin(string name, string password, string nameInput, string passwordInput)

  {

   if(name == nameInput && password == passwordInput)

   {

    Console.WriteLine($"Welcome {name}");

   }

   else{

    Console.WriteLine("Invalid user name or password");

   }

  }

 }

}

Comments

Popular Posts