/*vectorfunction templateprogrammer:qpz
*/
#include <iostream>
#include <vector>
#define MAX 10
using namespace std;
class Myclass{
private:vector <int> vel;//可均分的动态数组
public:void Add(int x){vel.push_back(x);}void print();
};
void Myclass::print()
{vector <int>::iterator it;for(it=vel.begin();it<vel.end();it++)cout<<*it<<endl;
}
int main(void)
{Myclass my;int i;for(i=0;i<MAX;i++)my.Add(i);my.print();cout<<endl;return 0;
}
转载于:https://www.cnblogs.com/pzqu/p/9457681.html