美文网首页
2018-12-27幸运抽奖(4)

2018-12-27幸运抽奖(4)

作者: 小短腿慢慢走 | 来源:发表于2018-12-27 11:26 被阅读0次

    (1) . 输入注册时的用户名和密码,登录成功,提示欢迎信息
    (2) . 如果用户名和密码输入错误,提示用户继续输入,最多有3次输入机会

     static void Main(string[] args)
        {
            int max = 99999;
            int min = 1000;
            Random rd = new Random();
            rd.Next(min, max);
            int a = 0;
            string user = "";
            string key = "";
            string b = "";
            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("用户名\t\t密码\t\t会员卡号");
                    Console.WriteLine("{0}\t\t{1}\t\t{2}", user, key, rd.Next(min, max));
                    Console.WriteLine("继续吗?(y/n)");
                    b = Console.ReadLine();
                    break;
                case 2:
                    Console.WriteLine("[奖客富翁系统>登录]");
                    user = "admin";
                    key ="123456";
                    int i=2;
                    while (i > -1)
                    {
                        Console.WriteLine("请输入用户名:");
                        string yonghu = Console.ReadLine();
                        Console.WriteLine("请输入密码:");
                        string mima = Console.ReadLine();
                        if (user == yonghu & key == mima & i > 0)
                        {
                            Console.WriteLine("欢迎您:{0}", yonghu);
                            break;
                        }
                        else
                        {
                            if (i > -1)
                            {
                                Console.WriteLine("你还剩{0}次机会", i);
                                i--;
                                continue;
                            }
                            else
                            {
                                Console.WriteLine("你的机会用完了");
                                break;
                            }
                        }
                    }
                    break;
                case 3:
                    Console.WriteLine("[奖客富翁系统>抽奖]");
                    break;
            }
            Console.WriteLine("继续吗?(y/n)");
            b = Console.ReadLine(); switch (b)
            {
                case "n":
                    Console.WriteLine("系统退出,谢谢使用");
                    break;
                case "y":
                    Console.WriteLine("");
                    break;
            }
            Console.ReadKey();
        }

    相关文章

      网友评论

          本文标题:2018-12-27幸运抽奖(4)

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