return c; }
ostream& operator << (ostream& output,Complex& c) { output<<\ return output; }
istream& operator >> (istream& input,Complex& c)
{ cout<<\ input>>c.real>>c.imag; return input; }
2、(17分)
class Circle:public Shape {public:
Circle(double r){radius=r;}
void set() { } {
cout<<\} cout<<\cin>>radius;
void show()
double area() {return 3.14159*radius*radius;} private: };
class Square:public Shape {public:
Square(double a){this->a=a;}
void set() { } {
cout<<\
}
cout<<\cin>>a; double radius;
void show()
double area(){return a*a;}
第 9 页
private: }; int main() { }
double a;
Circle C(5.5); C.show(); Square S(9.9); S.show();
Shape *s[]={&C,&S};
cout<<\ return 0;
第 10 页