排序算法
冒泡排序
int i = 0;
int j = 0;
int n = vecProps.size();
CPropsModel *pPropCurModel = NULL;
CPropsModel *pPropNextModel = NULL;
CPropsModel *pPropTempModel = NULL;
//第一个循环是一共有几个对象
//第二个具体的交换大小循序
for (j = 0; j < n ; j++)
{
for (i = 0; i < n-1-j ; i++)
{
pPropCurModel = (CPropsModel *) vecProps[i];
pPropNextModel = (CPropsModel *) vecProps[i+1];
if (pPropCurModel->GetPrice() > pPropNextModel->GetPrice())
{
pPropTempModel =(CPropsModel *) vecProps[i];
vecProps[i] = vecProps[i+1];
vecProps[i+1] = pPropTempModel;
}
}
}