#include
#include
#define MONTHS 12
int main()
{
int years,month,ret,day,a,math=0;
printf("Input:");
int days[2][MONTHS]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
ret=scanf("%d/%d/%d",&years,&month,&day);
while((ret!=1)||month12)
{
while(getchar()!='\n');
ret=scanf("%d/%d/%d",&years,&month,&day);
}
if(month==1)
{
math=day;
}
else
{
math=day;
if(((years%4==0)&&(years%100!=0))||(years%400==0))
{
for(a=1;a<month;a++)
{
math=days[0][month-a-1]+math;
}
}
else
{
for(a=1;a<month;a++)
{
math=days[1][month-a-1]+math;
}
}
printf("%d",math);
return 0;
}
程序一直報錯 expected declaration or statement at end of input
都要瘋了求解答
if(month==1)
{
math=day;
}
else
{
math=day;
這一個else少了個右花括號