练习5
来源:互联网 发布:免费动漫下载软件 编辑:程序博客网 时间:2024/05/29 05:10
#include <iostream>
using namespace std;
class Time{
public:
void setTime(int newH,int newM,int newS);
void showTime();
private:
int hour,minute,second;
};
void Time::setTime(int newH,int newM,int newS){
hour=newH;
minute=newM;
second=newS;
}
inline void Time::showTime(){
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
int main(){
Time mytime;
int x,y,z;
cout<<"Please input time:";
cin>>x>>y>>z;
mytime.setTime(x,y,z);
mytime.showTime();
if(x>12){
mytime.setTime(x-12,y,z);
mytime.showTime();
}
else{
mytime.setTime(x+12,y,z);
mytime.showTime();
}
return 0;
}
using namespace std;
class Time{
public:
void setTime(int newH,int newM,int newS);
void showTime();
private:
int hour,minute,second;
};
void Time::setTime(int newH,int newM,int newS){
hour=newH;
minute=newM;
second=newS;
}
inline void Time::showTime(){
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
int main(){
Time mytime;
int x,y,z;
cout<<"Please input time:";
cin>>x>>y>>z;
mytime.setTime(x,y,z);
mytime.showTime();
if(x>12){
mytime.setTime(x-12,y,z);
mytime.showTime();
}
else{
mytime.setTime(x+12,y,z);
mytime.showTime();
}
return 0;
}
0 0
- 练习5
- 练习5
- 练习5
- 练习5
- 练习5
- 练习5
- 练习5
- 练习5
- 练习5
- 【SICP练习】5 练习1.9
- //2.11练习.练习5(1).p37
- 课堂练习54页动手练习5
- jQuery练习5——val()练习
- tensoflow练习5:自动编码器练习
- 练习5-5
- 练习5-4
- NeuSoft练习5
- c练习5
- 练习3
- 【RabbitMQ】走进RabbitMQ
- 魔兽登陆页面
- 练习4
- ccf-Z字形扫描
- 练习5
- 第七届蓝桥杯java 交换瓶子
- RecyclerView添加head和footer
- Visual Studio对应的VC++版本
- 日志管理+磁盘管理
- 冒泡排序,从小到大,从大到小
- 复杂迷宫问题的递归实现以及最短路径
- 数据库中drop delete truncate 的区别
- C语言基本数据类型