www.ccmd.net > 一道C语言编程题求助:计算时间差V1.0

一道C语言编程题求助:计算时间差V1.0

#include int main(){ int h1,s1,h2,s2,h3,s3;;printf("Input time one(hour,second):");scanf("%d,%d",&h1,&s1);printf("Input time two(hour,second):");scanf("%d,%d",&h2,&s2);h3=h1-h2;s3=s1-s2;if(s3

使用一个2行12列的数组,分闰年与否记录各个月份的天数,然后后边的就简单了

#include void main() { int year,month; printf("\n Please input year:\n"); scanf("%d",&year); printf("enter month:\n"); scanf("%d",&month); if(year%4==0) { if(month==2) printf("\n day=%d",29); else { if(month==4||month==6||month...

#includeint sum(int month,int day)//计算平年的日期 {int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};int i;for(i=1;i=3)num++;printf("%d\n",num);}/*运行结果:2015 3 160*/

scanf()调用错误,应该写成: scanf("%d,%d", &year, &month); 你第一个参数写错啦。 答题不容易,大家互相帮助,望采纳,谢谢!

#include int main(void){ int year, mouth; printf("Input year: "); scanf("%d", &year); printf("Input mouth: "); scanf("%d", &mouth); switch( mouth ) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: printf("There are 3...

事实上,这帖写了主要功能的了 http://zhidao.baidu.com/question/168176370 补上输入、输出,就是整齐了 。。。。。。。。

简单,用蔡勒公式即可: #include int main () { int y, m, d, c, w; printf ("输入年 月 日(空格间隔):"); scanf ("%d %d %d", &y, &m, &d); if (m ==1 || m == 2) { //判断月份是否为1或2 y--; m += 12; } c = y / 100; y = y - c * 100; w...

#include typedef struct Mytime { int hour; int min; int sec; }T; int main(int argc, char *argv[]) { T t1, t2, t3; int sec1, sec2, sec3; printf("输入两个时间值,以XX:XX:XX的格式\n"); scanf("%d:%d:%d", t1.hour, t1.min, t1.sec); s...

#include //返回指定年月日是对应年度的第几天 int getDays(int month,int day); int isRunnian(int year); int main(int argc,char* argv[]) { int year=0; int month=0; int day=0; printf("请输入年月日格式示例20140101\n"); scanf("%4d%2d%...

网站地图

All rights reserved Powered by www.ccmd.net

copyright ©right 2010-2021。
www.ccmd.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com