Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- // c.push_back(25); add element at the vector.
- // c.size() size of the vector, parameter empty
- // c.begin() start
- // c.end() end
- int main(){
- vector <int> c;
- c.push_back(11);
- c.push_back(10);
- c.push_back(11);
- c.push_back(8);
- c.push_back(20);
- //function sort ( begin inicio , end fim)
- sort(c.begin(), c.end());
- //int tm = c.size;
- //adicionar o tm no segundo parameter do for, também funciona;
- for (int i = 0;i<(int)c.size(); i++)
- cout<<c[i]<<"\n";
- cout<<c.size()<<" Position \n";
- c.clear();
- // delete buffer
- // check class vector
- cout << endl;
- cout << c.size() << " Position \n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement