您当前的位置: 首页 > 

星许辰

暂无认证

  • 0浏览

    0关注

    466博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

杭电计算机2013年考研复试代码题

星许辰 发布时间:2021-03-09 09:23:23 ,浏览量:0

目录
  • 题目一
  • 题目二

题目一
简要描述:输入一个数,代表要检测的例子的个数,每个例子中: 
输入两个时间(格式HH:MM:SS),前面时间减去后面时间,输出在时钟上显示的时间,格式一样,
如果是以为数字的前面补零。 
#include 
#include 
#include 
#include 

using namespace std;

void TimeDiffer(){
	//有n个例子 
	int n;
	string t1,t2;
	int h1,m1,s1,h2,m2,s2;
	int h,m,s;
	cin>>n;
	while(n--){
		cin>>t1>>t2;
		//截取对应的时、分、秒 
		h1=atoi(t1.substr(0,2).c_str());
		m1=atoi(t1.substr(3,2).c_str());
		s1=atoi(t1.substr(6,2).c_str());
		h2=atoi(t2.substr(0,2).c_str());
		m2=atoi(t2.substr(3,2).c_str());
		s2=atoi(t2.substr(6,2).c_str());
		h=h1-h2;
		m=m1-m2;
		s=s1-s2;
		if(s            
关注
打赏
1665627467
查看更多评论
0.0395s