typedef struct Cun_Xian
{
double Xr,Yr,Xl,Yl;
double K, b;//y=kx+b一个临时性质的b//k为斜率
double Xx,Yx;
int Old_NO, New_NO;
} putL;
putL &operator=(putL &A,putL &B) //为了下面排序目的,我对赋值=进行了重载。但是这个是错误的:
{ error C2801: 'operator =' must be a non-static member
A.b=B.b; A.K=B.K;
A.New_NO=B. New_NO;
A.Old_NO=B.Old_NO;
A.Xl=B.Xl; A.Xr=B.Xr;
A.Yl=B.Yl; A.Yr=B.Yr;
A.Yx=B.Yx; A.Xx=B.Xx;
return A;
}
void Line_Sort()
{
for(int s=1;s<=size-1;s++)
{
if(L[s].Xr>L[s+1].Xr)
{
putL temp; //为了能够交换达到排序目的,我对赋值=进行了重载
temp=L[s];
L[s]=L[s+1];
L[s+1]=temp;
}
}
cout<<"调用了Line_Sort():\n";
}
请大家帮忙!
[此贴子已经被作者于2006-12-22 21:29:48编辑过]