解题思路:分别判断时位分位跟秒位是否小于10,小于则在前面加上0
注意事项:
参考代码:
#include <iostream>
using namespace std;
int main()
{int n,t;
cin>>n;
while(n--)
{ cin>>t;
if(t/3600<10)cout<<0<<t/3600<<":";
else cout<<t/3600<<":";
if(t/60%60<10)cout<<0<<t/60%60<<":";
else cout<<t/60%60<<":";
if(t%60<10)cout<<0<<t%60<<endl;
else cout<<t%60<<endl;
}
return 0;
}
0.0分
0 人评分
C语言训练-最大数问题 (C语言代码)浏览:633 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:605 |
C二级辅导-阶乘数列 (C语言代码)浏览:691 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:936 |
【蟠桃记】 (C语言代码)浏览:1024 |
【计算两点间的距离】 (C语言代码)浏览:1482 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:262 |
Tom数 (C语言代码)浏览:494 |
理财计划 (C语言代码)浏览:467 |
简单的a+b (C语言代码)浏览:629 |