题目链接
https://www.nowcoder.com/pat/6/problem/4052
代码
#include<iostream>
#include<math.h>
using namespace std;
int main() {
int c1, c2;
int hour, minute, second, totalSecond;
scanf("%d%d", &c1, &c2);
totalSecond = (c2 - c1 + 50) / 100;
hour = totalSecond / 3600;
minute = totalSecond % 3600 / 60;
second = totalSecond % 60;
printf("%02d:%02d:%02d", hour, minute, second);
return 0;
}
本文介绍了一种基于C++的秒杀计时器实现方案,通过输入两个时间戳,计算并显示剩余时间。该程序使用了标准输入输出库及数学库,并能够正确处理时间间隔的转换。
839

被折叠的 条评论
为什么被折叠?



