博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
改错3-38
阅读量:4307 次
发布时间:2019-06-06

本文共 1218 字,大约阅读时间需要 4 分钟。

#include
class time {
private: int hour,minute,second; public: void settime(int h,int m,int s) {
hour=(h>=0&&h<24)?h:0; minute=(m>=0&&m<60)?m:0; second=(s>=0&&s<60)?s:0; } void showtime() {cout<
<<':'<
<<':'<
<

 改后

View Code
#include
class time {
private: int hour,minute,second; public: void settime(int h,int m,int s) {
hour=(h>=0&&h<24)?h:0; minute=(m>=0&&m<60)?m:0; second=(s>=0&&s<60)?s:0; } void showtime() {
cout<
<<':'<
<<':'<
<

 改为外联函数:

View Code
#include
class time {
private: int hour,minute,second; public: void settime(int,int,int); void showtime(); }; void time::settime(int h,int m,int s) {
hour=(h>=0&&h<24)?h:0; minute=(m>=0&&m<60)?m:0; second=(s>=0&&s<60)?s:0; } void time::showtime() {
cout<
<<':'<
<<':'<
<

 

转载于:https://www.cnblogs.com/galczn/archive/2012/03/28/2421706.html

你可能感兴趣的文章
vc获取特殊路径(SpecialFolder)
查看>>
单例模式
查看>>
int(3)和int(11)区别
查看>>
201521123061 《Java程序设计》第十一周学习总结
查看>>
代码小思考
查看>>
Unity中的销毁方法
查看>>
ceph删除pool提示(you must first set the mon_allow_pool_delete config option to true)解决办法...
查看>>
2016-7-15(1)使用gulp构建一个项目
查看>>
CSS 设计指南(第3版) 初读笔记
查看>>
markdown学习/mou
查看>>
CentOS 搭建 LAMP服务器
查看>>
看完此文再不懂区块链算我输,用Python从零开始创建区块链
查看>>
C/S框架-WebService架构用户凭证(令牌)解决方案
查看>>
UVA 11149.Power of Matrix-矩阵快速幂倍增
查看>>
ajax post 请求415\ 400 错误
查看>>
POJ 2696 计算表达式的值
查看>>
都江堰很美-佩服古人_Crmhf的一天
查看>>
Linux系统资源查询命令(cpu、io、mem)
查看>>
(转)PowerHA完全手册(一,二,三)
查看>>
hdu 4391 Paint The Wall 线段树 +优化 2012 Multi-University Training Contest 10 )
查看>>