3.03 - Password as string

Objetive
Write a program to ask the user for his/her name and his/her password (both must be strings) and repeat it as many times as necessary, until the entered name is "user" and the password is "password".

Solution
using System;
public class PasswordString
{
public static void Main()
{
string user, password;

do
{
Console.Write("Enter a user: ");
user = Console.ReadLine();

Console.Write("Enter a password: ");
password = Console.ReadLine();
}
while ( user != "user" && password != "password" );

Console.WriteLine( "Bye!" );
}
} 

Popular Posts