一个简单问题
#include <stdio.h>void main()
{
int year,month,date;
int year1,month1,date1;
int age;
label:
printf("Enter a student's birthday\n");
scanf("%d %d %d",&year,&month,&date);
if(month>12||month<1)
{printf("月份错误请重新输入\n");
goto label;
}
if(month==1||3||5||7||8||10||12);
{
if(date>31||date<1)
{
printf("日期错误请重新输入\n");
goto label;
}
}
if(month==4||6||9||11)
{
if(date>30||date<1)
{
printf("日期错误请重新输入\n");
goto label;
}
}
if(month==2)
{
if(year%4==0)
{
if(date>28||date<1)
{
printf("日期错误请重新输入\n");
goto label;
}
}
else if(year%4!=0)
if(date>29||date<1)
{
printf("日期错误请重新输入\n");
goto label;
}
}
label1:
printf("Enter the current date\n");
scanf("%d %d% d",&year1,&month1,&date1);
if(month>12||month<1)
{printf("月份错误请重新输入\n");
goto label1;
}
if(month==1||3||5||7||8||10||12);
{
if(date>31||date<1)
{
printf("日期错误请重新输入\n");
goto label1;
}
}
if(month==4||6||9||11)
{
if(date>30||date<1)
{
printf("日期错误请重新输入\n");
goto label1;
}
}
if(month==2)
{
if(year%4==0)
{
if(date>28||date<1)
{
printf("日期错误重新输入\n");
goto label1;
}
}
else if(year%4!=0)
if(date>29||date<1)
{
printf("日期错误请重新输入\n");
goto label1;
}
}
age=year1-year;
if(month1<month)
{
age-=1;
printf("age=%d\n",age);
}
else if(month1>month)
{
printf("age=%d\n",age);
}
else if(month1==month)
{
if(date1<date)
{
age-=1;
printf("age=%d\n",age);
}
else
{ printf("f234");
age+=2;
printf("age=%d\n",age);
}
}
}
最后那个判断运行不完整else
{ printf("f234");
age+=2;
printf("age=%d\n",age);
}
就这个 好像没有运行