X=xx,
问题描述:
X=xx,
#include
#include
using namespace std;
class point
{
public:
point(int xx=0,int yy=0) {X=xx;Y=yy;}
int getX() {return X;}
int getY() {return Y;}
friend float fdist(point &a,point &b);
private:
int X,Y;};
float fdist(point &p1,point &p2)
{double x=double(p1.X-p2.X);
double y=double(p1.Y-p2.Y);
return float (sqrt(x*x+y*y));
}
void main(){point myp1(1,1),myp2(4,5);
cout
答
xx,yy是作为一个变量,是个整体的,不能分开,程序中没有x或y,单写一个程序会出错,X=xx,Y=yy是赋值语句,就是把xx的值赋给X,yy的值赋给Y