|
#include<iostream.h>
class Point
{
public:
Point(){cout<<""<<endl;};
~Point(){}
void Display()
{ cout<<"x="<<x<<"y="<<y<<endl; }
protected:
float x,y;
};
class PointCircle:public Point
{
private:
float r;
public:
PointCircle(){cout<<""<<endl;};
~PointCircle(){}
void SetPointCircle(float X,float Y,float R)
{
double L,S;
x=X;y=Y;r=R;
L=2*3.1415*R;
S=3.1415*R*R;
}
void Display()
{cout<<x<<y<<L<<S<<endl;}
};
void main()
{
PointCircle p1;
p1.SetPointCircle(1,1,1);
p1.Display();
cout<<endl;
}
这个程序是定义一个点类Point,并由此派生出一个圆类.有两个错误
i:\p23941\p23941.cpp(27) : error C2065: 'L' : undeclared identifier
i:\p23941\p23941.cpp(27) : error C2065: 'S' : undeclared identifier
Error executing cl.exe.
P23941.exe - 2 error(s), 0 warning(s)
我想来想去还是没改出来....
哪位帮一下忙啊....
谢谢.... |
|