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

#includeint main(){int h1,m1,h2,m2,t; printf("Input time one(hour,minute):"); scanf("%d,%d",&h1,&m1); printf("Input time two(hour,minute):"); scanf("%d,%d",&h2,&m2); if(h2

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

#include "stdio.h" struct student { int year; int month; int day; }; year(int year) { if((year%4==0&&year%100==0)||(year%400==0)) return 1; else return 0; } month(int n) { switch(n) { case 1:return 31; case 2:return 28; case 3:...

#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*/

#include "stdio.h" #include "conio.h" main() { int day,month,year,sum,leap; printf("\nplease input year,month,day\n"); scanf("%d,%d,%d",&year,&month,&day); switch(month) /*先计算某月以前月份的总天数*/ { case 1:sum=0;break; case...

#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...

#include int main() { int s,day; printf("请输入秒数\n"); scanf("%d",&s); if(0 == s%24%60) { day = s/24/60; } else { day = s/24/60 + 1//这里的+1表示有多余秒数折算为1,例如输入1秒则为1天而不是0天; } printf("已经过了%d天\n",day); ...

#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%...

简单,用蔡勒公式即可: #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...

网站地图

All rights reserved Powered by www.ccmd.net

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