解题思路:把当前月之前天数加起来 再加上当前日期
注意事项:日期需要正确输入
参考代码:
#include <stdio.h>
int main()
{
int x,y,s=0;
scanf("%d%d",&x,&y);
switch(x-1)
{
case 11 :s+=30;
case 10 :s+=31;
case 9 :s+=30;
case 8 :s+=31;
case 7 :s+=31;
case 6 :s+=30;
case 5 :s+=31;
case 4 :s+=30;
case 3 :s+=31;
case 2 :s+=28;
case 1 :s+=31;
}
s+=y;
printf("%d",s);
}
0.0分
2 人评分
2005年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:584 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:791 |
Pascal三角 (C语言代码)格式错误浏览:516 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:850 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:2080 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:536 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:664 |
简单的a+b (C语言代码)浏览:543 |
大家好,我是验题君浏览:576 |
C二级辅导-分段函数 (C语言代码)浏览:593 |