0

my code

I was wondering if someone can look at this and see if there are any problem class MainClass { public static List<string> nomi = new List<string>(); public static List<string> password = new List<string>(); public static bool startup = true; public static bool logged = false; public static void Main (string[]args) { Start(); } // Starting loop public static void Start() { string choice; { console.WriteLine ("Do you want to login or register"); choice = Console.ReadLine(); switch(choice) { case "register": Register(); break; case"login": Login (ref logged, out startup); break; default: Console.WriteLine( "Error, please repeat."); Console.WriteLIne(); } } }//Logged in loop public static void Run() { string app; while (logged== true) { Console.WriteLine ("Choose an app: Calculator, Logout, Exit."); app = Console.ReadLine(); if (app == "calculator"){ Calc(); }else if (app == "check"){ Check(); }else if (app == "exit"){ Console.WriteLine("Goodbye."); logged = false; }else if (app =="logout"){ logged = false; startup = true; Console.WriteLine (); Start(); }else{ Console.WriteLine("Invalid app"); Console.WriteLine(); } } } //Registration and login methods public static void Register() { Console.WriteLine("Choose a Name:"); nomi.Add (Console.Readline()); Console.WriteLine("Choose a password"); password.Add (Console.Readline()); Console.WriteLine(); } public static bool Login(ref bool logged, out bool startup) { string name; string pwd; Console.WriteLine ("Write your username"); name = Console.ReadLine(); foreach (string nome in nomi){ if (nome == name){ Console.WriteLine (" Write your Password"); pwd = Console.ReadLine(); foreach (string pword in password){ Console.WriteLine("You are logg

14th May 2018, 3:33 AM
Andrew Williams
Andrew Williams - avatar
1 Answer