美文网首页
第十七节课第五个课上练习

第十七节课第五个课上练习

作者: 流影随风 | 来源:发表于2018-12-27 09:25 被阅读0次

              try

                {

                    Console.WriteLine("*******欢迎进入抽奖系统*******");

                    Console.WriteLine(@"            1.注册

                2.登录

                3.抽奖");

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

                    Console.Write("选择是:");

                    string num = Console.ReadLine();

                    switch (num)

                    {

                        case "1":

                            Console.WriteLine("[富豪系统>注册]");

                            break;

                        case "2":

                            Console.WriteLine("[富豪系统>登录]");

                            break;

                        case "3":

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

                            break;

                        default:

                            Console.WriteLine("输入错误");

                            break;

                    }

                    if (num == "3")

                    {

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

                        string str_word = Console.ReadLine();

                        int word=Convert.ToInt32(str_word);

                        Console.WriteLine();

                        int max = 9999;

                        int min = 1000;

                        Random rd = new Random();

                        int f = 0;

                        int g = 0;

                        int h = 0;

                        int j = 0;

                        int k = 0;

                        f = rd.Next(min, max);

                        g = rd.Next(min, max);

                        h = rd.Next(min, max);

                        j = rd.Next(min, max);

                        k= rd.Next(min, max);

                        Console.WriteLine("今日幸运卡号是:{0}  {1}  {2}  {3}",f,g,h,j);

                        if (word == f || word == g || word == h || word == j||word == k)

                        {

                            Console.WriteLine("恭喜你是幸运会员!");

                        }

                        else

                        {

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

                        }

                    }

                    else

                    {

                        Console.WriteLine("进入抽奖界面进行抽奖");

                    }

                }

                catch

                {

                    Console.WriteLine("输入错误");

                }

                Console.WriteLine("继续吗?[y/n]");

                string a = Console.ReadLine();

                if (a == "y")

                {

                    try

                    {

                        Console.WriteLine("*******欢迎进入抽奖系统*******");

                        Console.WriteLine(@"            1.注册

                2.登录

                3.抽奖");

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

                        Console.Write("选择是:");

                        string num = Console.ReadLine();

                        switch (num)

                        {

                            case "1":

                                Console.WriteLine("[富豪系统>注册,ture]");

                                break;

                            case "2":

                                Console.WriteLine("[富豪系统>登录]");

                                break;

                            case "3":

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

                                break;

                            default:

                                Console.WriteLine("输入错误");

                                break;

                        }

                    }

                    catch

                    {

                        Console.WriteLine("输入错误");

                    }

                }

                else if (a == "n")

                {

                    Console.WriteLine("系统退出");

                }

                else

                {

                    Console.WriteLine("输入错误");

                }

                Console.ReadKey();

    相关文章

      网友评论

          本文标题:第十七节课第五个课上练习

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