(1) . 系统询问用户是否继续
(2) . 如果用户选择继续,则可以继续选择菜单,否则程序结束,退出系统
static void Main(string[] args)
{
int a = 0;
string b = "y";
while (b == "y")
{
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("[奖客富翁系统>注册]");
break;
case 2:
Console.WriteLine("[奖客富翁系统>登录]");
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();
网友评论