#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
using namespace std;
int main(){
vector <int>obj;//创建一个向量存储容器
for(int i=;i<;i++)
{
obj.push_back(i); //在vector尾部加入一个数据 string中的push_back表示在字符串之后插入一个字符
cout<<obj[i]<<",";
}
cout<<"\n"<<endl;
for(int i=;i<;i++)
{
obj.pop_back(); //去掉数组最后一个数据
}
for(int i=;i<obj.size();i++)//size() 容器中实际数据个数
{
cout<<obj[i]<<",";
}
cout<<"\n"<<endl;
/*obj.clear();//清除容器中的数据
for(int i=0;i<obj.size();i++)//size() 容器中实际数据个数
{
cout<<obj[i]<<",";
}*/
sort(obj.begin(),obj.end());//从小到大排序
for(int i=;i<obj.size();i++)//size() 容器中实际数据个数
{
cout<<obj[i]<<",";
}
cout<<"\n"<<endl;
reverse(obj.begin(),obj.end());//从大到小
for(int i=;i<obj.size();i++)//size() 容器中实际数据个数
{
cout<<obj[i]<<",";
}
system("pause");
return ;
}

最新文章

  1. iOS应用程序的生命周期
  2. flex-布局,轻松制作移动端网页
  3. CSS层叠
  4. C#操作文件夹及文件的方法的使用
  5. DP:Corn Fields(POJ 3254)
  6. unity, 由unity5.2.1升级到5.4.2物体变亮解法
  7. UI1_Calayer
  8. ArcEngine做栅格数据拉伸
  9. Python学习笔记12:标准库之对象序列化(pickle包,cPickle包)
  10. 关于No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=armv7 armv7s)使用百度地图的解决办法
  11. EL表达式的简单实用
  12. EasyUI的Datagrid鼠标悬停显示单元格内容
  13. word文档转pdf,支持.doc和.docx,另附抽取pdf指定页数的方法
  14. java打包发布程序.jar(Eclipse)
  15. oracle表分区创建
  16. ssh agent-forward
  17. SpringMVC 处理Date类型数据@InitBinder @DateTimeFormat 注解 的使用
  18. 【BZOJ2820】ygy的gcd
  19. 线程【五】VCL下的线程类
  20. shell脚本中对简单实现对log的处理

热门文章

  1. android 长按弹出菜单,复制,粘贴,全选
  2. Go -- RPC 之 Thrift
  3. flask的debug模式下,网页输入pin码进行调试
  4. 深入理解javascript之设计模式
  5. BubbleGum96 开箱杂谈与软件资源
  6. GridView的经常使用属性
  7. Android开发的环境搭建及HelloWorld的实现
  8. val();html();.text()区别 setInterval与setTimeout的区别
  9. openwrt procd 运行的一些log
  10. u-boot简单学习笔记(二)——AR9331 uboot.lds分析