美文网首页
抽奖系统

抽奖系统

作者: BlingBling007 | 来源:发表于2019-01-07 11:23 被阅读0次

try{

bool flag = true;  //用于判断是否继续执行

string name;

int key;

int max = 9999;

int min = 1000;

Random rd = new Random();

do{

//界面

Console.WriteLine("*****欢迎进入奖客富翁系统*****");

Console.WriteLine(@"

1.注册

2.登录

3.抽奖");

Console.WriteLine("******************************");

Console.WriteLine();

Console.Write("请输入菜单:");

//训练1

int num = Convert.ToInt32(Console.ReadLine());

switch (num)

{

case 1:

Console.WriteLine("奖客富翁系统>注册");

Console.WriteLine("请填写个人注册信息:");

Console.Write("用户名:");

name = Console.ReadLine();

Console.Write("密码:");

key = Convert.ToInt32(Console.ReadLine());

Console.WriteLine();

Console.WriteLine("注册成功,请记好您的会员卡号");

Console.WriteLine("用户名\t密码\t卡号\t");

Console.WriteLine("{0}\t{1}\t{2}\t", name, key, rd.Next(min, max));

break;

case 2:

Console.WriteLine("奖客富翁系统>登录");

Console.Write("请输入用户名:");

name = Console.ReadLine();

Console.Write("请输入密码:");

key = Convert.ToInt32(Console.ReadLine());

Console.WriteLine();

if (name == "admin" && key == 111111)

{

Console.WriteLine("欢迎您:{0}", name);

}

else

{

Console.WriteLine("您输入的帐号或密码错误");

}

break;

case 3:

Console.WriteLine("奖客富翁系统>抽奖");

Console.Write("请输入您的卡号:");

int ads = Convert.ToInt32(Console.ReadLine());

Console.WriteLine();

Console.WriteLine("本日的幸运数字为:{0} {1} {2} {3} {4}", rd.Next(min, max), rd.Next(min, max), rd.Next(min, max), rd.Next(min, max), rd.Next(min, max));

if (ads != rd.Next(min, max))

{

Console.WriteLine("抱歉!您不是本日的幸运会员!");

}

else

{

Console.WriteLine("恭喜您成为本日的幸运会员,您将获得1000元现金");

}

break;

default:

Console.WriteLine("请输入1~3,否则无效");

break;

}

Console.Write("是否继续?(y/n):");

string answer = Console.ReadLine();

if (answer == "n")

{

Console.WriteLine("系统退出,谢谢使用!");

}

if (answer == "y")

{

flag = true;

}

else

{

flag = false;

}

}while(flag);

}

catch

{

Console.WriteLine("您输入的程序错误");

}

Console.ReadKey();

相关文章

网友评论

      本文标题:抽奖系统

      本文链接:https://www.haomeiwen.com/subject/abayrqtx.html