?? p254 例8.3 完整的類.cpp
字號(hào):
#include<iostream>
using namespace std;
class Time
{ private:
int hour;
int minute;
int second;
public:
void set_time();
void show_time();
};
void Time::set_time()
{ cout<<"請(qǐng)輸入小時(shí)值: ";
cin>>hour;
cout<<"請(qǐng)輸入分鐘值: ";
cin>>minute;
cout<<"請(qǐng)輸秒鐘值: ";
cin>>second;
}
void Time::show_time()
{
cout<<hour<<": "<<minute<<": "<<second<<endl;
}
int main()
{ Time t1,t2;
t1.set_time();
t1.show_time();
t2.set_time();
t2.show_time();
system("pause");
return 0;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -