日本虐杀幼童:紧急:找出程序的错误。急用。谢谢!!

来源:百度文库 编辑:中科新闻网 时间:2024/05/07 04:15:38
一个万年历程序。
这里有错误清给以指导。谢谢。
就是下面“好一个字”给的那个程序。

#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "ctype.h"
int monthdays[12]={31,28,31,30,31,30,31,31,30,31,30,31};
char *weekarr[7]={"Sunday", "Monday","Tuesday","Wednesday","Thuesday","Friday","Saterday"};
char *montharr[12]={"JAN","FEB","MAR","API","MAY","JUN","JUL","AGU","SEP","OCT","NOV","DEC"};
typedef struct Date
{
int year;
int month;
int day;
};
void mainmenu(void)
{
system("cls");
printf("\n\t\t***************************");
printf("\n\t\t* *");
printf("\n\t\t* 万 年 历 *");
printf("\n\t\t* *");
printf("\n\t\t***************************");
printf("\n\n\t1.inquire about the date which you wanna know;");
printf("\n\n\t2.inquire about the year which you input is leap year or not;");
printf("\n\n\t3.print the whole calendar of the year which you input;");
printf("\n\n\t4.exit;");
printf("\n\n\tSelect the option which you wanna to do:");
}
void backorexit(void)
{
char ch;
printf("\nchoose back to mainmenu or exit(B/E):");
ch=getchar();
scanf("%c",&ch);
while(toupper(ch)!='B' && toupper(ch)!='E')
{
printf("\ninput error,please input again:");
scanf("%c",&ch);
}
if(toupper(ch)=='B')
mainmenu();
else
exit(0);
}
int isleap(int year)
{
return ((year%4==0 && year%100!=0) || (year%400==0))?1:0;
}
int inquire(Date a)
{
int i;
int s,c=0;
monthdays[1]=isleap(a.year)?29:28;
for(i=0;i<a.month-1;i++)
c+=monthdays[i];
c+=a.day;
s=(int)(a.year-1+(a.year-1)/4-(a.year-1)/100+(a.year-1)/400+c);

return s%7;
}
void printcalendar(void)
{
int year,i,j,t;
Date a;
system("cls");
printf("input the year which you wanna show:");
scanf("%d",&year);
a.year=year;
monthdays[1]=isleap(a.year)?29:28;
for(i=0;i<12;i++)
{
printf("\n\n%s",montharr[i]);
printf("\n\tsun\tmon\ttue\twed\tthu\tfri\tsat\n");
a.month=i+1;
a.day=1;
t=inquire(a);
for(j=0;j<inquire(a);j++)
printf("\t");
for(j=1;j<=monthdays[i];j++)
{
printf("\t%d",j);
t++;
if(t%7==0)
printf("\n");
}
}
}
void main()
{
int option;
int year;
mainmenu();
while(1)
{
scanf("%d",&option);
switch (option)
{
case 1:
Date a;
system("cls");
printf("please input the date as the form as month-day-year:");
scanf("%d-%d-%d",&a.month,&a.day,&a.year);
printf("\nthe day is %s",weekarr[inquire(a)]);
backorexit();
break;
case 2:
system("cls");
printf("please input the year which you wanna inquire:");
scanf("%d",&year);
if(isleap(year))
printf("this year is a leap year\n");
else
printf("this year is not a leap year\n");
backorexit();
break;
case 3:
printcalendar();
backorexit();
break;
case 4:
exit(0);
break;
default:
printf("input error\n");
}
}
}

没有程序清单啊

什么意思呀〉?

程序呢