Vector当做引用在在函数中传递

Posted on 2008-10-10 11:10 Robert Su 阅读(4627) 评论(0)  编辑  收藏 所属分类: C/C++
#include "stdafx.h"
#include 
<iostream>
#include 
<vector>   
using   namespace std;   


void   vect(vector<int>   &ve)   
{   
          ve.push_back(
100);   
}
   
    
void   main()   
{   
          vector
<int>   v;   
          vect(v);
          
for (vector<int>::iterator it = v.begin();it != v.end();++it)
          cout
<<*it<<endl;}

          cin.
get();
}

只有注册用户登录后才能发表评论。


网站导航:
 

posts - 103, comments - 104, trackbacks - 0, articles - 5

Copyright © Robert Su