我的稀碎代码
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
//用户名:sexy girl ;密码:12345678 布尔类型判断
//只要用户名错误或者密码错误就重新输入
//最多尝试三次 while循环
string admin = "";
string psw = "";
int i = 1;
while (i <= 3 && (admin != "sexy girl" || psw != "12345678"))
{ Console.WriteLine("请输入用户名");
admin = Console.ReadLine();
Console.WriteLine("请输入密码");
psw = Console.ReadLine();
if (admin == "sexy girl" && psw == "12345678")
{
Console.WriteLine("登陆成功");
//break;//跳不出do...while循环,只有当登录一次性成功才行
}
else if (admin != "sexy girl" || psw != "12345678")
{
Console.WriteLine("输入错误,请重新输入");
}
i++;}
if (i >3)
{
Console.WriteLine("不能再试了");
}
Console.ReadLine();
}
}
}