完成以下要求:
int z=0;
string u = "y";
Console.WriteLine("*******欢迎进入奖客富翁系统*********");
Console.WriteLine("1.注册");
Console.WriteLine("2.登录");
Console.WriteLine("3.抽奖");
Console.WriteLine("*******************************");
string y = "";
string t = "";
int max = 9999;
int min = 1000;
Random rd = new Random();
int q = 0;
q = rd.Next(min, max);
while (u == "y")
{
Console.WriteLine("请选择菜单:");
int i = Convert.ToInt32(Console.ReadLine());
switch (i)
{
case 1:
Console.WriteLine("注册");
Console.WriteLine("写");
Console.WriteLine("用户名:");
y = Console.ReadLine();
Console.WriteLine("密码:");
t = Console.ReadLine();
Console.WriteLine("注册成功");
Console.WriteLine("用户名 密码 卡号");
Console.WriteLine(y + " " + t + " " + q);
break;
case 2:
Console.WriteLine("登录");
break;
case 3:
Console.WriteLine("抽奖");
Console.WriteLine("请登录,请输入用户名:");
string w = Console.ReadLine();
Console.WriteLine("请输入密码:");
string e = Console.ReadLine();
if (w==y&&e==t)
{
Console.WriteLine("输入正确");
Console.WriteLine("请输入卡号:");
if (q==Convert.ToInt32(Console.ReadLine()))
{
for (int j = 0; j < 5; j++)
{
int[] df=new int[5];
df[j] = rd.Next(min, max);
Console.WriteLine(df[j]);
if (df[j]==q)
{
z = 1;
}
}
if (z==1)
{
Console.WriteLine("是幸运数字");
}
else
{
Console.WriteLine("不是幸运数字");
}
}
else
{
Console.WriteLine("卡号错误");
}
}
else
{
if (w!=y)
{
Console.WriteLine("还未注册");
}
if (e!=t)
{
Console.WriteLine("密码错误");
}
}
break;
}
Console.WriteLine("是否继续?(y/n)");
u = Console.ReadLine();
if (u != "y")
{
Console.WriteLine("关闭程序");
}
}
Console.ReadKey();
网友评论