#ifndef head_h
#define head_h
class CBase
{private:
int pointx;
int pointy;
public:
CBase(int=0,int=0);
int GetPointx();
int GetPointy();
void SetPointx(int=0);
void SetPointy(int=0);
};
CBase::CBase(int x,int y)
:pointx(x),pointy(y)
{
}
int CBase::GetPointx()
{
return pointx;
}
int CBase::GetPointy()
{
return pointy;
}
void CBase::SetPointx(int x)
{
pointx=x;
}
void CBase::SetPointy(int y)
{
pointy=y;
}
class CImport :public CBase
{//城市或收获点类
private:
intOrder;
doubleTime;
doubleEarlytime;
doubleLatetime;
doubleLoad;
public:
CImport(int=0,int=0,int=0,double=0,double=0,double=0,double=0);
void SetTime(int=0);
int GetOrder() ;
double GetTime() ;
double GetEarlytime() ;
double GetLatetime() ;
double GetLoad() ;
void Print () ;
//void operator=(const Import&);
};
CImport::CImport(int x,int y,int ord, double lo,double t1,double t2,double t3)
:CBase(x,y)
{//构造函数
Order=ord;
Load=lo;
Earlytime=t1;
Latetime=t2;
Time=t3;
}
int CImport::GetOrder()
{
return Order;
}
double CImport::GetTime()
{
return Time;
}
double CImport::GetEarlytime()
{
return Earlytime;
}
double CImport::GetLatetime()
{
return Latetime;
}
double CImport::GetLoad()
{
return Load;
}
class CVehicleExport:public CBase
{//发货点类(发货点集合了车场的性能)
private:
char name;
intVehicleNum;
public:
CVehicleExport(char='A',int=0,int=0,int=0);
void SetVehicleNum(int);
char GetName() ;
int GetVehicleNum() ;
operator CImport();
void Print() ;
// void operator=(const VehicleExport&);
};
CVehicleExport::CVehicleExport(char ch,int x,int y,int num)
:CBase(x,y)
{//构造函数
name=ch;
VehicleNum=num;
}
void CVehicleExport::SetVehicleNum(int z)
{//某出货点运货需要的车辆数初始化
VehicleNum=z;
}
char CVehicleExport::GetName()
{
return name;
}
int CVehicleExport::GetVehicleNum()
{
return VehicleNum;
}
template
void ss(T& t1,T& t2)
{
T hold=t2;
t2=t1;
t1=hold;
}
template
void quicksort (T *array,int hi,int lo=0)
{
while (hi>lo)
{
int i=lo;
int j=hi;
do {
while ((arrayarray[lo]);
if (ihi-(j+1))
{
quicksort (array,j-1,lo);
lo=j+1;
}
else
{
quicksort (array,hi,j+1);
hi=j-1;
}
}// end of for while (hi>lo)
}// end of for quicksort
#endif
详细一点 十分感谢
|