bool b = true; while (b) { Console.WriteLine("*****欢迎进入奖客富翁系统"); Console.WriteLine(" 1.注册 "); Console.WriteLine(" 2.登录 "); Console.WriteLine(" 3.抽奖 "); Console.WriteLine("****************************"); Console.Write("请选择菜单"); int a = Convert.ToInt32(Console.ReadLine()); switch (a) { case 1: Console.WriteLine("奖客富翁系统>注册"); break; case 2: Console.WriteLine("奖客富翁系统>登录"); break; case 3: Console.WriteLine("奖客富翁系统>抽奖"); break; default: Console.WriteLine("你输入的格式有误"); break; } Console.WriteLine("你是否继续(yes/no)"); string c = Console.ReadLine(); if (c == "yes") { b = true; } else if (c == "no") { b = false; } else { Console.WriteLine("程序结束,系统退出"); Console.ReadKey(); }
bool b = true; while (b) { Console.WriteLine("*****欢迎进入奖客富翁系统"); Console.WriteLine(" 1.注册 "); Console.WriteLine(" 2.登录 "); Console.WriteLine(" 3.抽奖 "); Console.WriteLine("****************************"); Console.Write("请选择菜单"); int a = Convert.ToInt32(Console.ReadLine()); switch (a) { case 1: Console.WriteLine("奖客富翁系统>注册"); break; case 2: Console.WriteLine("奖客富翁系统>登录"); break; case 3: Console.WriteLine("奖客富翁系统>抽奖"); break; default: Console.WriteLine("你输入的格式有误,程序退出"); break; } Console.WriteLine("请填写个人注册信息"); Console.WriteLine("用户名: "); string name = Console.ReadLine(); Console.WriteLine("密码: "); int h = Convert.ToInt32(Console.ReadLine()); int max = 99999; int min = 1000; Random rd = new Random(); ; Console.WriteLine("注册成功,请记好你的会员卡号"); Console.WriteLine("用户名\t密码\t会员卡号"); Console.WriteLine("{0}\t{1}\t{2}", name, h, rd.Next(min, max)); Console.WriteLine("继续吗?(yes/no)"); string d = Console.ReadLine(); if (d == "yes") { b = true; } if (d == "no") { Console.WriteLine("系统退出,谢谢使用"); Console.ReadKey(); } }