using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { //定义方法一 public static void PrintInfo() { Console.WriteLine("Hello World! \n I‘m Coming!"); } //定义方法二 public static void Check(int imput_date) { /* int imput_date; Console.WriteLine("Please input date:"); imput_date = Console.Read(); */ switch (imput_date) { case 0: Console.WriteLine("今天是星期1"); break; case 1: Console.WriteLine("今天是星期2"); break; case 2: Console.WriteLine("今天是星期3"); break; case 3: Console.WriteLine("今天是星期4"); break; case 4: Console.WriteLine("今天是星期5"); break; case 5: Console.WriteLine("今天是星期6"); break; case 6: Console.WriteLine("今天是星期7"); break; default: Console.WriteLine("请输入正确的日期!"); break; } } static void Main(string[] args) { //使用方法: PrintInfo(); Check(0); Check(1); Check(2); Check(5); Check(8); Console.Read(); } } }
运行结果如下:
时间: 2024-10-12 10:11:08