?? 302a.cpp
字號:
/* 302a.cpp -- Written By S.Y.Feng demo constructor and overload of Time class*/
#include <iostream.h>
class Time // define Time class
{
int hh,mm,ss;
public:
Time(){hh=0;mm=0;ss=0;}
Time(int h,int m=0,int s=0){hh=h;mm=m;ss=s;}
void Set(int h, int m, int s) {hh = h; mm = m; ss=s;}
void Disp();
};
void Time::Disp()
{
cout << "The time is " << hh << ":"
<< mm << ":" << ss <<endl;
}
int main()
{
Time t1(1,11),t2(2,22,22); //兩個對象
t1.Disp();
t2.Disp();
return 0;
}
/*
The time is 1:11:0
The time is 2:22:22
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -