作业帮 > 英语 > 作业

英语翻译You are supplied with a date which should be in the form

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/16 11:23:20
英语翻译
You are supplied with a date which should be in the form day in the month (1 t0 31),month(1 to 12),year(1760 onwards).You should first check the validity of the date (that the above limites are observed,and that the day number is valid for the month- so 31,6 is not valid as there are only 30 days in June).You should check for leap years; a leap year occurs when the year is divisible either by 400,or by 5 but not 100 (so 1996,2000,2004 and 2008 were all leap years,but 1900 was not).
Your should then produce a string with the day within the month followed by "st","rd" or "th" as appropriate,followed by the full month name,followed by a comma and then the year.So 22,1,1944 should produce the string;
22 nd January,1944
Your program should repeatedly prompt hte user for a date.As long as a positive day in the month is typed in,the program should format the date approiately; when a zero or negative day is typed in the program should halt.
For this task you should provide your own code for checking the validity of the date,etc.,and not rely on methods provided by the C# environment.
这是我自己翻的,对计算机不是特别熟悉,概括大意就是要你编一个程序,当用户输入一个格式像"22,1,1944"这样的日期,程序首先要按照规则判定日期有效性,之后输出一个“22nd,January,1944”的日期.
给你一个格式为“日,月,年”的日期,首先你应该检查日期的有效性,观察其是否符合规则(日为1到31,月份为1到12,年份为1760年以后的,注意“日”应该与所在的月份对应,如月份6前面出现31是无效的,因为6月只有30天).你也应当检查闰年,闰年年份数字能被400整除,或者能被4整除但不能被100整除.(因此,1996.,2000,2004以及2008都是闰年,但是1990年为非闰年).之后你应当得出一行字,“日”的数字后面以”st”、”rd”或者”th”为后缀,月份以名称标出,最后是年份,中间以逗号隔开.因而,“22,1,194”就应当记为“22nd,January,1944”.当你得到一个日期,它的格式应该为你 “日,月,年”.首先,你应当检查日期的有效性,观察它是否符合所有的规则(日为1到31日,月份为1到12月,年份为1760年以后,并注意月份与天数的对应,如6月前面就不应出现31,因为6月只有30天).你也要检查闰年,闰年年份数字能被400或者能被4整除但不能被100整除(因此,1996,2000,2004和2008是闰年,但1900不是闰年).然后,你应该能写出一个日期,包含:一个月里面以”st’”,“rd”或者”th”结尾的日,月份全称,以及年份,两个数字中间一逗号隔开.因而,“22,1,1944”应当产生格式为 “22nd,January,1944”的日期.
你的程序应当能够反复为用户生成日期.只要一个日期被输入,程序就能生成一个规定格式的日期.当0或者无效的日期被输入的时候,程序应当停止.
这个任务要求你自己编程来检查输入日期的有效性等,不能依赖C#环境提供的方法.