资讯中心

19、时间转换

📅 2026/8/30 0:02:38
19、时间转换
#include iostream #include iomanip // setw setfill 格式化补0需要这个头文件 using namespace std; int main() { int n; cout 请输入总秒数; cin n; int hour n / 3600; // 小时 int minute n % 3600 / 60; // 分钟 int sec n % 60; // 秒 // setw(2)占两位setfill(0)不足补0 cout setfill(0) setw(2) hour : setw(2) minute : setw(2) sec endl; return 0; }

看完文章,想为自己的企业也做一次专业网站诊断?

尧图顾问免费为您评估现有网站,并给出建站/改版建议与报价方案。

免费获取方案