⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rectangle1.h

📁 c++小程序
💻 H
字号:
	
class Rectangle
{
	public:
		void Init(double Initx,double Inity);     //设定宽、高的初始值	
		void Init1(double Initx); 
	    double GetWidth(){return Width;}	//得到宽度
	    double GetHeight(){return Height;}				//得到高度
		double Area(double Width,double Height){return Width*Height;}				//计算长方形的面积
	    void Display();		//显示长方形的信息(包括宽、高和面积)
	private:
		double Width,Height;

};

void Rectangle::Init1(double Initx)
{
		Width=Initx;
		Height=Initx;
}


void Rectangle::Init(double Initx,double Inity)
{
	if(Inity==0)
	{
		Width=Initx;
		Height=Initx;
	}
	else
	{
		Width=Initx;
		Height=Inity;
	}
}
void Rectangle::Display()
{
	cout<<"长"<<GetWidth()<<"宽"<<GetHeight()<<"面积"<<Area(Width,Height)<<endl;
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -