#编码
//用户输入用户名和密码,只要不是admin、88888就一直提示用户名或密码错误,请重新输入
string user = "";
string password="" ;
while(user!="admin"||password!="88888")
{
Console.WriteLine("请输入用户名");
user = Console.ReadLine();
Console.WriteLine("请输入密码");
password = Console.ReadLine();
}
Console.WriteLine("成功");
Console.ReadKey();
或者
string user = "";
string password="" ;
do
{
Console.WriteLine("请输入用户名");
user=Console.ReadLine();
Console.WriteLine("请输入密码");
password=Console.ReadLine();
}
while (user != "admin" || password != "88888");
Console.WriteLine("成功");
Console.ReadKey();