奖客富翁系统python_作业 2018-12-28 20.1 奖客富翁

题目

奖客富翁系统

代码

try

{

string shifou;

string name;

int password;

do

{

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

Console.WriteLine(@"

1.注册

2.登录

3.抽奖");

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

Console.Write("请选择菜单:");

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

if (daan == 1)

{

Console.WriteLine("[奖课富翁系统>注册]");

Console.WriteLine("请输入个人注册信息:");

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

name = Console.ReadLine();

Console.Write("密码:");

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

Random random = new Random(); //随机生成会员卡号

int n = random.Next(1000, 9999);

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

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

Console.WriteLine("{0}\t{1}\t{2}", name, password, n);

}

else if (daan == 2)

{

name = "admin";

password = 123456;

Console.WriteLine("[奖课富翁系统>登录]");

int a = 0;//储存用户名或者密码输错的次数

for (int i = 0; i < 3; i++)

{

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

string name1 = Console.ReadLine();

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

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

if (name1 == name && password1 == password)

{

Console.WriteLine("欢迎您:admin");

break;

}

else

{

Console.WriteLine("用户名或密码输入错误,请重新输入");

a++;

}

if (a == 3)

{

Console.WriteLine("你已经输错了三次,不能在输入");

}

}

}

else if (daan == 3)

{

Console.WriteLine("[奖课富翁系统>抽奖]");

Console.Write("请输入你的会员卡号:");

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

int[] xysz = new int[5];//xysz为幸运数字

Console.Write("本日的幸运数字为:");

for (int i = 0; i < 5; i++)

{

Random random = new Random();

int n = random.Next(1000, 9999);

xysz[i] = n;

Console.WriteLine(xysz[i] + "\t");

if (xysz[i] == vipnum)

{

Console.WriteLine("恭喜你,你是本日的幸运会员");

break;

}

if (i == 4)

{

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

}

}

}

else

{

Console.WriteLine("你输入的格式有误");

}

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

shifou = Console.ReadLine();

if (shifou == "n")

{

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

}

} while (shifou != "n");

}

catch

{

Console.WriteLine("你输入的格式有误");

}

Console.ReadKey();

效果图

image.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值