c# 之入门简介1
2021-06-21 04:05
标签:thread got main code wrong option you 语句 case goto 语句 c# 之入门简介1 标签:thread got main code wrong option you 语句 case 原文地址:https://www.cnblogs.com/Mengchangxin/p/10246610.htmlusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _5._12跳转
{
class Program
{
static void Main(string[] args)
{
int a = 0;
Console.WriteLine("5的阶乘等于几?请选择:");
Console.WriteLine("1. 5!=5\n2. 5!=10\n3. 5!=20\n4. 5!=60");
error:
{
a++;
if (a > 1) Console.WriteLine("you are wrong!");
}
int option = int.Parse(Console.ReadLine());
switch (option)
{
case 1:
case 2:
case 3:goto error;
case 4:goto right;
default:
Console.WriteLine("请重新选择。");
goto end; }
right:
{
Console.WriteLine("ok!!!!");
}
end:
Console.ReadKey();
}
}
}
上一篇:Windows10通过VNC远程连接Ubuntu18.04
下一篇:C#之泛型