时间间隔
来源:互联网 发布:sql begin end 编辑:程序博客网 时间:2024/06/11 07:58
问题及代码:
/*。*Copyright(c)2014,烟台大学计算机学院*All right reserved,*文件名:test.cpp*作者:liu_feng_zi_*完成日期:2014年12月22日*版本号:v1.0*问题描述:计算时间间隔*输入描述:输入两个时间点*程序输出:输出两个时间点的间隔*/#include <iostream>using namespace std;int main(){ int h1,h2,h3; int m1,m2,m3; int s1,s2,s3; int h,m,s; int sum1,sum2; char a,b; cin>>h1>>a>>m1>>b>>s1; cin>>h2>>a>>m2>>b>>s2; sum1=h1*3600+m1*60+s1; sum2=h2*3600+m2*60+s2; if(sum1>sum2) { h=h1; h1=h2; h2=h; m=m1; m1=m2; m2=m; s=s1; s1=s2; s2=s; } h3=h2-h1; m3=m2-m1; s3=s2-s1; if( s3<0) { s3+=60; m3--; } if(m3<0) { m3+=60; h3--; } if(h3<10) cout<<"0"<<h3<<":"; else cout<<h3<<":"; if(m3<10) cout<<"0"<<m3<<":"; else cout<<m3<<":"; if(s3<10) cout<<"0"<<s3; else cout<<s3; return 0;}
运行结果:
0 0
- 时间间隔
- 时间间隔
- 时间间隔
- 时间间隔
- c# 计算时间间隔
- 计算时间间隔函数
- datediff()获取时间间隔
- 获取时间间隔
- c# 计算时间间隔
- Linux计算时间间隔
- mysql 时间间隔
- mysql 时间间隔函数
- 时间间隔计算
- 时间间隔测量器类
- 计算时间间隔
- 两个时间间隔
- 获取时间间隔 iphon
- C#时间间隔计算
- 了解DOM:引用类型,基本包装类型和单体内置对象
- Windows无法访问指定设备、路径或文件。您可能没有合适的权限访问这个项目
- wpf inkcanvas 多点绘画
- 了解DOM:Javascript正则表达式
- 一元多项式计算器(链式结构)
- 时间间隔
- 分享一个win7 下串口转换USB的驱动程序
- 【图像处理】python-ImageDraw
- 织梦安装好关于PHP5.3以上版本报错
- OC语言之block
- Maven by Example 1.1. Maven… What is it?
- 数据库为什么要分库分表及实现策略
- 银行业务模拟
- SA001-借助IBInspectable和约束定制1像素宽的线(view)