bool AscendSort(int a, int b) /* 升序排序*/
{
return a < b;
}
bool DecreaseSort(int a, int b) /* 升序排序*/
{
return a > b;
}
void Vector_add_ele(vector<int> & InputVec, int ele)
{
InputVec.push_back(ele);
}
本文介绍了如何使用C++标准库中的`vector`容器进行元素的增加、删除操作,并提供了升序和降序排序的自定义函数示例,以及遍历`vector`的基本方法。
bool AscendSort(int a, int b) /* 升序排序*/
{
return a < b;
}
bool DecreaseSort(int a, int b) /* 升序排序*/
{
return a > b;
}
void Vector_add_ele(vector<int> & InputVec, int ele)
{
InputVec.push_back(ele);
}
1038

被折叠的 条评论
为什么被折叠?