// 看例子自己品
#include<bits/stdc++.h>
using namespace std;vector<int> v;void out()
{cout<<"size:"<<v.size()<<" - ";for( int i=0;i<v.size();i++ ) cout<<v[i]<<' '; cout<<endl;
}int main()
{int n;while( cin>>n ){if( n==0 ) break; v.clear();v.resize(n); out();v.push_back(n); out();v.pop_back(); out(); v[1]=n; out();}return 0;
}
// 4
// size:4 - 0 0 0 0
// size:5 - 0 0 0 0 4
// size:4 - 0 0 0 0
// size:4 - 0 4 0 0
详细解决方案
vector_ v.resize()+v[i] “vs“ v.push_back(x);
热度:26 发布时间:2023-12-06 05:04:20.0
相关解决方案
- apple push notification 服务器设计有关问题?
- I am back,该如何解决
- VS2005有没有类似SourceInsight的“Go Back”的查看功能啊解决办法
- Vector.clear 的有关问题
- vector push_back出错(release版本),该如何处理
- 水晶报表 push 模式下显示数据的困惑,该怎么解决
- Response.Write("<script language='javascript' type='text/javascript'>history.back()</script>")
- 怎么测试wap push
- Push proxy gateway 网关模拟器软件相关有关问题(参与有分!)
- 入栈指令 PUSH FLAG;这么写对吗?该怎么解决
- 高难,怎么用一个指令实现 push st1 + (sp++)
- 每日背熟一句英语(5)By the time he got back to his coffee it was stone-cold
- 每天背熟一句英语(5)By the time he got back to his coffee it was stone-cold.解决办法
- vector 对象数组删除有关问题
- sourcefilter与Elecard MPEG Push Demultiplexer连接不下
- Push Source Filter无法显示图像解决思路
- dshow push mode filter,怎么增加接口
- 关于Elecard MPEG PUSH Demultiplexer 在GE 设置 outpin解决办法
- 苹果信息推送服务(Apple Push Notification Service)施用总结
- 一个关于"符号: 类 Vector"的问题
- 请教 Vector vetinon= new Vector();这个语句是什么意思啊?
- javascript/html中半角单/双引号变换,及Array push/join方法的使用(转)
- zend framework 如何实现http push
- struts2.x 的交付表单出现 Could not create and/or set value back on to object
- history.back()丢失会话数据的解决方法
- google Chrome浏览器上,按后退按钮*history.back() 缓存有关问题
- history.back() 网页已过期的解决方法
- history.back 遇到有关问题
- 关于调用history.back()后显示网页过期的有关问题
- ZK框架初始总结【二】-关于server-push