0
I'm a C# beginner and my code wouldn't run. I'd really appreciate your help.
using System; namespace Login { class Program { public static void Main() { string username; string password; Console.WriteLine("Username: "); username = Console.ReadLine(); Console.WriteLine("Password:"); password = Console.ReadLine(); if (username == "molo"; password == "molo2005") { Console.WriteLine("Welcome Back, Ucef"); else { Console.WriteLine("Sorry, the username or password is incorrect."); } } } } }
1 Respuesta
+ 4
if (username == "molo" && password == "molo2005")
// molo it's && and not ; and also you have not put braces } in proper places.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Login
{
class Program
{
public static void Main()
{
string username;
string password;
Console.WriteLine("Username: ");
username = Console.ReadLine();
Console.WriteLine("Password:");
password = Console.ReadLine();
if (username == "molo" && password == "molo2005")
{
Console.WriteLine("Welcome Back, Ucef");
}
else
{
Console.WriteLine("Sorry, the username or password is incorrect.");
}
}
}
}