- static void Main(string[] args)
- {
- bool flag;
- do
- {
- flag = false;
- Console.WriteLine("请输入用户名");
- string userName = Console.ReadLine();
- Console.WriteLine("请输入密码");
- string passWord = Console.ReadLine();
- if (userName != "admin" || passWord != "888888")
- {
- Console.WriteLine("用户名和密码错误,请重新输入");
- flag = true;
- }
- } while (flag);
- Console.WriteLine("登录成功");
- }
复制代码 |