运用Visual Studio测生肖
1、打开Visual Studio程序软件,选择新建项目。
2、选择Visual C#,控制应用台,然后确定。
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];
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:79
阅读量:39
阅读量:90
阅读量:25
阅读量:31