你能帮我做这个问题吗? [英] Can you help me do this question ?
本文介绍了你能帮我做这个问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
开发一个控制台应用程序,要求用户输入一个介于1900年和2012年之间的年份.当用户按Enter键时,该程序必须显示输入的年份和2012年之间的所有the年.方案
让我们采取一种协作的方式:从控制台获取用户输入完全取决于您,而我写的是"leap"检查:
bool jump =年% 400 == true :年份% 100 == 0 ? 错误:年份% 4 == 0 ? true : false ;
c#具有一个内置功能来检查leap年
DateTime.IsLeapYear(int< year>)
// 在输入的年份中以整数形式输入" for ( int i = input; i< = 2012 ; i ++) 如果(DateTime.IsLeapYear(i) Console.WriteLine(i)
通过下面的链接,
http://www.leonmeijer.nl/archive/2008/02/29/68.aspx [ ^ ]
谢谢
--RA
Develop a console application that asks user to enter a year between 1900 and 2012. When the user press enter key, the program must display all the leap year between the inputted year and 2012.
解决方案
Let''s we take a collaborative approach: getting the user input from console is up to you, while I write written the ''leap'' check:
bool leap = year % 400 == 0 ? true : year % 100 == 0 ? false : year % 4 == 0 ? true : false;
c# has a built-in function to check leap year
DateTime.IsLeapYear(int <year>)
//let "input" b the entered year in integer for(int i=input;i<=2012;i++) if(DateTime.IsLeapYear(i) Console.WriteLine(i)
Go through the below link,
http://www.leonmeijer.nl/archive/2008/02/29/68.aspx[^]
Thanks
--RA
这篇关于你能帮我做这个问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文