c++ 第三章4
来源:互联网 发布:java do while循环语句 编辑:程序博客网 时间:2024/06/01 08:26
问题及代码:
/*编写一个程序要求用户以整数形式输入秒数,然后以天、小时、分钟、秒的形式显示这段时间。*/#include <iostream>using namespace std;int main(){ long seconds; int second,minute,hour,day; cout<<"Enter the number of seconds:"; cin>>seconds; second=seconds%60; minute=seconds/60; hour=minute/60; day=hour/24; minute=minute%60; hour=hour%24; cout<<seconds<<"second="<<day<<"days"<<hour<<"hours"<<minute<<"minutes"<<second<<"seconds"; return 0;}
运行结果:
0 0
- c++primer 第三章习题(4)
- 第三章 3.5.4 C风格字符串
- [C++]第三章 数据类型
- C++primer 第三章
- C++primer 第三章
- C语言第三章
- C第三章
- 第三章: C语言程序设计初步
- 第三章 - 数据和C
- 第三章,C++中的C
- 《C现代方法》第三章
- 第三章 C语言程序设计初步
- C 谭浩强 (第三章) char
- C算法 读书笔记 第三章
- c语言程序设计第三章题解
- [C++]第三章 2014.11.30
- 第三章 数据和C
- C Primer Plus 第三章
- MyMathLib系列(行列式计算4--向量部分)
- 一个线程池的例子(三)
- Linux - 上传项目到SVN分支
- 2014年12月26日
- 16Sending the User to Another App(隐式Intent意图)
- c++ 第三章4
- 2014年12月27日
- BNU新生赛总结
- java IO--获取指定目录下(包含子目录)指定拓展名的文件
- Linux - Git使用方法-下载子模块
- Linux串口c_cc测试与精讲
- Object-C学习笔录(四)多线程编程
- Linux - GitHub Contribution无法显示结果
- 为什么有些程序猿找不到私活