int a = 0;
string b = "";
string user = "";
string key = "";
int id =0;
string newuser = "";
string newkey = "";
int max = 99999;
int min = 1000;
Random rd = new Random();
;
Console.WriteLine("*******欢迎进入富翁系统********");
Console.WriteLine(" 1.注册");
Console.WriteLine(" 2.登陆");
Console.WriteLine(" 3.抽奖");
Console.WriteLine("********************************");
Console.WriteLine("请选择菜单:");
a = Convert.ToInt32(Console.ReadLine());
switch (a)
{
case 1:
Console.WriteLine("奖客富翁系统>注册");
Console.WriteLine("请填写个人注册信息");
Console.WriteLine("用户名");
user = Console.ReadLine();
Console.WriteLine("密码");
key = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("注册成功,请记好您的会员卡号");
Console .WriteLine ("用户名\t\t\t密码\t\t\t会员卡号");
Console .WriteLine ("{0}\t\t\t{1}\t\t\t{2}",user,key,rd.Next(min, max));
break;
case 2:
Console.WriteLine("奖客富翁系统>登陆");
int i = 2;
while (i > -1)
{
Console.WriteLine("请输入用户名");
user = "admin";
newuser = Console.ReadLine();
Console.WriteLine("请输入用户密码");
key = "123456";
newkey = Console.ReadLine();
Console.WriteLine("");
if (newuser == "admin" && newkey == "123456")
{
Console.WriteLine("欢迎你{0}", user);
break;
}
else
{
if (i > -1)
{
Console.WriteLine("你还剩{0}机会",i);
i--;
continue;
}
else
{
Console.WriteLine("你没机会了");
break;
}
}
}
break;
case 3:
Console.WriteLine("奖客富翁系统>抽奖");
Console.WriteLine("请输入您的卡号");
id =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("本日的随机数是:");
for (int q = 0; q < 5; q++)
{
Console.Write(rd.Next(min, max)+"\t");
}
if (rd.Next(min, max) == id)
{
Console.WriteLine("");
}
else
{
Console.WriteLine("抱歉您不是本日的会员");
}
break;
}
Console.WriteLine("继续使用该系统吗? yes/no");
b = Console.ReadLine();
switch (b)
{
case "yes":
Console.WriteLine("");
break;
case "no":
Console.WriteLine("退出系统,谢谢使用。");
break;
}
Console.ReadKey();