帮我看一个这个C#中的方法哪里错了呀~

来源:百度知道 编辑:UC知道 时间:2024/09/21 08:49:00
public void Login()
{
int cho = 0;
do
{
Student stud = new Student();
Console.WriteLine("请输入用户名");
stud.Username = Console.ReadLine();
Console.WriteLine("请输入用户密码:");
stud.Password = Console.ReadLine();
if(cho<3)
{
Console.WriteLine("请再次输入用户名:");
string a = Console.ReadLine();
Console.WriteLine("请再次输入密码");
string b = Console.ReadLine();
if (stud.Username == a && stud.Password == b)
{
Console.WriteLine("恭喜您注册成功!");
}
else
{
Console.Writ

看明白不?括号位置错了
if(cho<3)
{
Console.WriteLine("请再次输入用户名:");
string a = Console.ReadLine();
Console.WriteLine("请再次输入密码");
string b = Console.ReadLine();
if (stud.Username == a && stud.Password == b)
{
Console.WriteLine("恭喜您注册成功!");
}
else
{
Console.WriteLine("对不起您的输入有误请核对后重新输入!");
cho++;
break;
}
}
else
{
Console .WriteLine ("对不起您已错误三次请重新注册!");
return;
}