Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<vector>
- using namespace std;
- int main()
- {
- vector<int> a(5,10);
- a.push_back(4);
- a.push_back(0);
- int nb=a.size();
- int size=a.capacity();
- cout << "nb a = " << nb << " size a = " << size << endl;
- vector<int> myvector;
- for (int i=1; i<=5; i++) myvector.push_back(i);
- for (vector<int>::iterator it = myvector.begin() ; it != myvector.end(); ++it)
- cout << ' ' << *it;
- cout << endl;
- for (auto i : myvector)
- {
- cout << i << ' ';
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement