using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
string result;
Console.WriteLine("请输入用户名");
string name = Console.ReadLine();
Console.WriteLine("请输入密码");
string password = Console.ReadLine();
if (Test(name, password, out result))
{
Console.WriteLine(result);
}
else
{
Console.WriteLine(result);
}
Console.ReadKey();
} static bool Test(string name, string password, out string result)
{
if (name == "admin" && password == "")
{
result = "登录成功";
return true;
}
else if (name == "admin")
{
result = "密码错误";
return false;
}
else
{
result = "用户名错误";
return false;
}
}
}
}