学习vector中的at
// vector::at
#include <iostream>
#include <vector>
using namespace std;
//description:Returns a reference to the element at position n in the vector.
int main ()
{
vector<int> myvector (10); // 10 zero-initialized ints
// assign some values:
for (unsigned i=0; i<myvector.size(); i++)
myvector.at(i)=i;
cout << "myvector contains:";
for (unsigned i=0; i<myvector.size(); i++)
cout << ' ' << myvector.at(i);
cout << '\n';
for(vector<int>::iterator it =myvector.begin();it!=myvector.end();++it)
cout<<' '<<*it;
return 0;
}