.创建一个Rectangle类,添加两个属性width和height。在Rectangle类中添加两个方法,计算矩形的周长和面积

[复制链接]
查看11 | 回复1 | 2011-11-9 23:54:51 | 显示全部楼层 |阅读模式
/// c++class Rectangle{
int width, height;public:
Rectangle()
: width(0), height(0)
{}
Rectangle(int w, int h)
: width(w), height(h)
{}
void setWidth(int w)
{
width = w;
}
int getWidth()const
{
return width;
}
void setHeight(int h)
{
heig...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行