ja_mario14
Addict
- Joined
- Apr 1, 2022
- Posts
- 102
- Reaction
- 16
- Points
- 89
using System;
class LabExercise2
{
static void Main() {
// Correct Credential
string username = "Juan";
string password = "Santos";
//User input username and password
Console.Write("\nUsername : ");
string un = Console.ReadLine();
Console.Write("Password : ");
string pw = Console.ReadLine();
//Condition
if(un.Equals(username) && pw.Equals(password))
{
Console.WriteLine("\nSuccessfully Login.");
}
else if(!un.Equals(username) || pw.Equals(password))
{
Console.WriteLine("\nYou entered an invalid user name.");
}
else if(un.Equals(username) || !pw.Equals(password))
{
Console.WriteLine("\nYou entered an invalid password.");
}
else if(un.Equals(username) && pw.Equals(password))
{
Console.WriteLine("\nYou entered an invalid user name and password.");
}
}
}
===========================================================================
Pls help. hindi ko po makuha yung tamang return.
anu po yung mali sa code? or tama po ba yung code structure and logic.
PS. Sorry po inilagay ko lang sa text box yung code, wala po kasing option sakin para ilagay yung code ko po sa code box.
Thank you in advance. Gobless us.
class LabExercise2
{
static void Main() {
// Correct Credential
string username = "Juan";
string password = "Santos";
//User input username and password
Console.Write("\nUsername : ");
string un = Console.ReadLine();
Console.Write("Password : ");
string pw = Console.ReadLine();
//Condition
if(un.Equals(username) && pw.Equals(password))
{
Console.WriteLine("\nSuccessfully Login.");
}
else if(!un.Equals(username) || pw.Equals(password))
{
Console.WriteLine("\nYou entered an invalid user name.");
}
else if(un.Equals(username) || !pw.Equals(password))
{
Console.WriteLine("\nYou entered an invalid password.");
}
else if(un.Equals(username) && pw.Equals(password))
{
Console.WriteLine("\nYou entered an invalid user name and password.");
}
}
}
===========================================================================
Pls help. hindi ko po makuha yung tamang return.
anu po yung mali sa code? or tama po ba yung code structure and logic.
PS. Sorry po inilagay ko lang sa text box yung code, wala po kasing option sakin para ilagay yung code ko po sa code box.
Thank you in advance. Gobless us.
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.