Basic14.时间转换

题目:输入一个数,按照时:分:秒输出。

例如:

输入:5436

输出:1:30:36

#include<iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	int h=t/3600;
	int m=(t-3600*h)/60;
	int s=t-3600*h-60*m;
	cout<<h<<":"<<m<<":"<<s<<endl;
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/qq_41496951/article/details/85199508