switch语句

Console.WriteLine("请输入月份");
    string strInput = Console.ReadLine();
   switch(strInput)
    {
      case "1":
      case "2":
      case "3":
          Console.WriteLine("春天");break;
     case "4":
     case "5":
     case "6":
            Console.WriteLine("夏天"); break;
     case "7":
     case "8":
     case "9":
         Console.WriteLine("秋天"); break;
    case "10":
    case "11":
    case "12":
         Console.WriteLine("冬天"); break;
    default:
         Console.WriteLine("你输入不符合要求");break;
     }

相关文章:

  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2021-12-04
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-01-09
  • 2021-11-29
  • 2022-03-05
  • 2021-05-09
相关资源
相似解决方案