/* zheng int is divided yinshu*/
#include "stdio.h"
#include "conio.h"
int main()
{
int year,month,day;
int sum=0;
int leap=0;
printf("请输入年月日");
scanf("年:%d月:%d日:%d",year,month,day);
int jan=31,feb=28+jan,may=31+feb,apr=30+may,mar=31+apr,june=30+mar,july=31+june,aug=31+july,
sept=30+aug,oct=31+sept,nov=30+oct;
if((year%400==0)||((year%4)&&(year%100!=0)))
leap++;
switch(month)
{
case 1:printf("天数:%d",day);break;
case 2:printf("天数:%d",jan+day);break;
case 3:printf("天数:%d",feb+day+leap);break;
}
getch();
return 0;
}
这是我写的一个判断日子数的小程序。代码是没有问题的,我有个地方不太明白,scanf输入这块执行的时候,值不能都输进去。好奇怪。编译器也没有报错滴啊