美文网首页
第18节课第一个练习

第18节课第一个练习

作者: Deku啊 | 来源:发表于2018-12-27 08:50 被阅读0次

#作业目标:

##编码:

/**

          * 输出菜单

          * 选择菜单编号,输出内容

          * 编号选择有误输入错误

          * */

            //输出菜单

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

            Console.WriteLine(@"      1.注册

      2.登录

      3抽奖");

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

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

            //选择菜单编号

            string str_num = Console.ReadLine();

            try { int num = Convert.ToInt32(str_num);

                  switch(num)

                  {case 1:

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

                          break;

                  case 2:

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

                          break;

                  case 3:

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

                          break;

                default:

                          Console.WriteLine("您输入有误!");

                          break;

                  }

            }

            catch { Console.WriteLine("您输入有误!"); }

            Console.ReadKey();

###实际效果:

相关文章

网友评论

      本文标题:第18节课第一个练习

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