这个查错函数,我不知道如何放才正确,
#include<stdio.h>int main()
{
void c(int a,int b,int c);
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int day,m,y,nub=0,i;
printf("Please enter year,month,day:\n");
scanf("%d,%d,%d",&y,&m,&day);
c(y,m,day);
if((y%4==0&&y%100!=0)||y%400==0)
days[2]=days[2]+1;
for(i=0;i<m-1;i++)
nub=nub+days[i];
printf("the day is %d\n",nub+day);
return 0;
}
void c(int a,int b,int c)
{
if(a<1||b<1||b>12||c<1||c>31)
{
printf("Eorror!!Please check year,month,day!\n");
printf("Please enter year,month,day:\n");
scanf("%d,%d,%d",&y,&m,&day);
}
}
是求某年某月某日是该年的第几天的程序,C是一个查错函数,但我不知道怎么在主函数内调用才正确,求大家帮帮忙