匿名用户
1级
2011-05-27 回答
C#源程序:
using System;
class Program3
{
static void Main()
{
int year, year1, year2, month1, month2, day1, day2, week, sum = 0;
int[] days = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int i;
Console.Write("年:");
year = int.Parse(Console.ReadLine());
Console.Write("周次:");
week = int.Parse(Console.ReadLine());
if (year < 0)
{
Console.WriteLine("年份错误,必须大于等于0");
return;
}
if (week < 1 || week > 54)
{
Console.WriteLine("周次错误,必须位于 1 .. 53 之间");
return;
}
sum += 7 * (week - 1);
//修正总天数
switch (DateTime.Parse(year + "-1-1").DayOfWee