using System;
using System.Collections.Generic;
using System.Text;
namespace while判断用户名密码
{
class Program
{
static void Main(string[] args)
{
bool count = true;
while (count)
{
Console.WriteLine("请输入帐号");
string username = Console.ReadLine();
Console.WriteLine("请输入密码");
string password = Console.ReadLine();
if (username == "admin" && password == "888")
{
count = false;
}
else
{
count = true;
}
}
Console.WriteLine("欢迎使用本系统");
Console.ReadKey();
}
}
}
用户登录验证程序
这是一个C#编写的简单程序,利用while循环不断要求用户输入帐号和密码,直到输入正确的帐号'admin'和密码'888',否则会继续提示重新输入。
要求用户输入帐号、密码,只要不是admin和888就一直提示要求重新输入&spm=1001.2101.3001.5002&articleId=8487242&d=1&t=3&u=040195be244e487090b99b132ac28686)
781

被折叠的 条评论
为什么被折叠?



