Ⅰ 北邮同学C语言题啊~我哭啊~在线等答案啊
//---------------------------------------------------------------------------
#include <stdio.h>
int CheckLeap(int year)
{
return ((year%4==0)&&(year%100)||(year%400==0));
}
int GetWeekDay(int year,int month,int day)
{
if (month<3) {
month+=12;
year--;
}
return (day+2*month+3*(month+1)/5+year+year/4-year/100+year/400+1) % 7 ;
}
int GetMonthDays(int year,int month)
{
switch (month) {
default:
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:return 31;break;
case 4:
case 6:
case 9:
case 11:return 30;break;
case 2:return CheckLeap(year)?29:28;break;
}
}
void PrintMonthCalender(int startDay,int days)
{
int i,j=0;
printf("Sun.\tMon.\tTue.\tWed.\tThu.\tFri.\tSat.\n");
for (i = 0; i<startDay; i++) {
putchar('\t');
j++;
}
for (i=1; i<=days; j++,i++) {
if (j&&j%7==0) {
putchar('\n');
}
printf("%d\t",i);
}
}
int main(int argc, char* argv[])
{
int year,month;
printf("Input the year and month<yyyy-mm>:");
scanf("%d-%d",&year,&month);
printf("\t\t%d-%02d\n",year,month);
PrintMonthCalender(GetWeekDay(year,month,1),GetMonthDays(year,month));
return 0;
}
//---------------------------------------------------------------------------
Ⅱ 计算方法第二版课题6答案
题目
Ⅲ 求北邮电大网络2011春季学期计算机文化基础阶段五答案
1D 2B 3C 4A 5C 6C 7B 8A 9D 10A 对第一到第六题答案我不太确定!希望能对你有帮助1