📄 3-0-7答.txt
字号:
#include <iostream.h>
class Rectangl{
private:
int Width;
int Height;
public:
void Init(int w,int h){ Width=w;Height=h;}
//Rectangl(int w,int h){ Width=w;Height=h;}
//Rectangl(int w,int h):Width(w),Height(h){}
void SetWidth(int w){Width=w;}
void SetHeight(int h){Height=h;}
int GetWidth(){return Width;}
int GetHeight(){return Height;}
int Area(){return Width*Height;}
void DispInfo()
{
cout<<"Width="<<Width;
cout<<",Height="<<Height;
cout<<",Area="<<Width*Height<<endl;
}
};
void main()
{
Rectangl a;
a.Init(10,20);
//Rectangl a(10,20);
a.DispInfo();
a.SetWidth(8);
a.DispInfo();
a.SetHeight(2*a.GetHeight());
a.DispInfo();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -