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

📄 8-5.h

📁 c++事例,填充表格信息,插入删除修改保存
💻 H
字号:
#define PI 3.14
class Shape
{
public:
	float virtual GetArea()=0;
	float virtual GetPerim()=0;
};

class Rectangle:public Shape
{
private:
	float l,w;
public:
	Rectangle(float l=0,float w=0);
	float GetArea();
	float GetPerim();
};
Rectangle::Rectangle(float l, float w)
{
	this->l=l;
	this->w=w;
}
float Rectangle::GetArea()
{
	return l*w;
}
float Rectangle::GetPerim()
{
	return 2*(l+w);
}
class Circle:public Shape
{
private:
	float r;
public:
	Circle(float r=0);
	float GetArea();
	float GetPerim();
};
Circle::Circle(float r)
{
	this->r=r;
}
float Circle::GetArea()
{
	return r*r*PI;
}
float Circle::GetPerim()
{
	return 2*PI*r;
}

⌨️ 快捷键说明

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