运用Visual Studio测生肖

2024-10-12 17:21:33

1、打开Visual Studio程序软件,选择新建项目。

运用Visual Studio测生肖

3、最后就可以写程序了,生肖的代码static void Main(string[] args) 撑俯擂摔{ Console.Write("年份:"); int n; n = int.Parse(Console.ReadLine()); Console.WriteLine(n + "年的生肖是:" + calxs(n)); Console.ReadLine(); } static public String calxs(int year) { int i = year % 12; String[] name = { "猴", "鸡", "狗", "猪", "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊" }; return name[i];

运用Visual Studio测生肖
猜你喜欢