Jump to content

syzerchas

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About syzerchas

  • Rank
    Newbie
  1. Didn't work or i misunderstood using System; namespace ReadlinPractice { class Program { static void Main(string[] args) { string passWord = "pass123"; string userName = "user"; Console.WriteLine("Please enter your username below!"); string userName2 = Console.ReadLine(); string userName4; do { Console.WriteLine("User not found! Please re-enter your username"); string userName4 = Console.ReadLine(); } while (userName4 != userName); } } } I did this, and i tried putting string userName4; in the do aswell but it just created more errors.
  2. using System; namespace ReadlinPractice { class Program { static void Main(string[] args) { string passWord = "pass123"; string userName = "user"; Console.WriteLine("Please enter your username below!"); string userName2 = Console.ReadLine(); do { Console.WriteLine("User not found! Please re-enter your username"); string userName4 = Console.ReadLine(); } while (userName4 != userName); } } } I want it to loop "User not found! etc" while im typing a non-exisiting username, but i cant make it work since i cant use userName4 outside of the 4th curly brackets (dont remember what its called (parameters?)), how can i work around this.
  3. using System; namespace ReadlinPractice { class Program { static void Main(string[] args) { string passWord = "pass123"; string userName = "user"; Console.WriteLine("Please enter your username below!"); string userName2 = Console.ReadLine(); if (userName != userName2); { Console.WriteLine("User not found! Please re-enter your username"); string userName3 = Console.ReadLine(); string result = (userName3 != userName) ? "Blocked, please try again in 5 minutes." : "Error, please restart the program."; Console.WriteLine(result); } else { Console.WriteLine("User found. Please enter your password."); string passWord2 = Console.ReadLine(); if (passWord != passWord2) { Console.WriteLine("Wrong password entered, please try again in 5 minutes"); } else { Console.WriteLine("Congrats, successfully logged in!"); } } } } } How can I fix this??
×
×
  • Create New...