#include<stdio.h>int main(){ int y[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int year,month,day,z=0,i,n; printf("请输入年-月-日:"); scanf("%d-%d-%d\n",year,month,day); for(i=0;i<14;i++) { z=z+y[i] ; if(1+i==month) break; } n=z+day; if(year%400==0||year%4==0&&year%100!=0) printf("%d",n+1); else printf("%d",n); return 0;}
2 回答
onemoo
TA贡献883条经验 获得超454个赞
scanf函数中你要的接受输入的变量,应该传入其指针,也就是要取地址后传入:
scanf("%d-%d-%d\n", &year, &month, &day)
- 2 回答
- 0 关注
- 1456 浏览
添加回答
举报
0/150
提交
取消