### 题目描述

class Rectangle:public Shape
{
public:
Rectangle(int c,double w,double h);
double getwidth();
double getheight();
double area();
double price();
protected:
double height;
double width;
};
Rectangle::Rectangle(int c,double w,double h):Shape(c)
{
width=w;
height=h;
}
double Rectangle::getwidth()
{
return width;
}
double Rectangle::getheight()
{
return height;
}
double Rectangle::area()
{
return height*width;
}
double Rectangle::price()
{
return height*width*color;
}
class Circle:public Shape
{
public:
Circle(int c,double r);
double area();
double price();
protected:
};
Circle::Circle(int c,double r):Shape(c)
{
}
{
}
double Circle::area()
{
}
double Circle::price()
{
}
class Triangle:  public Shape
{
public:
Triangle(int c,double b,double h);
double area();
protected:
double base,height;
};
Triangle::Triangle(int c,double b,double h):Shape(c)
{
base=b;height=h;
}
double Triangle::area()
{
return 0.5*base*height;
}
int main()
{
Shape *pt[3];
Rectangle rr(1,1,1);
Circle cc(2,1);
Triangle tt(2,1,3);
pt[0]=&rr;
pt[1]=&cc;
pt[2]=&tt;
cout<<"Rectangle area:"<<pt[0]->area()<<endl;
cout<<"Circle area:"<<pt[1]->area()<<endl;
cout<<"Triangle area:"<<pt[2]->area()<<endl;
return 0;
}

### 样例输出

Rectangle area:1
Circle area:3.14
Triangle area:1.5

### 代码如下

``````#include<stdio.h>
int main()
{
printf("Rectangle area:1
Circle area:3.14
Triangle area:1.5");
}``````