帮忙注释一段c++ 就20分了 帮帮忙吧 谢谢了

[复制链接]
查看11 | 回复1 | 2010-5-27 23:51:19 | 显示全部楼层 |阅读模式
#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
详细一点 十分感谢

回复

使用道具 举报

千问 | 2010-5-27 23:51:19 | 显示全部楼层
#ifndef head_h#define head_h//下面是一个点类,pointx,pointy相当于(x,y)class CBase //定义一个类CBase{private:
//表示私有int pointx;int pointy;//两个私有整形变量 public://表示下面的函数是公共的CBase(int=0,int=0);//类的构造函数,0,0代表默认值点(0,0)也就是初始化int GetPointx();//获取x的值,也就是x轴int GetPointy();//获取y的值,也就是y轴void SetPointx(int=0);//设置x的值,也就是
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行