Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// 9. standard template library (STL)
- #include<bits/stdc++.h>
- using namespace std;
- signed main(){
- vector<int> vec; // some dynamic length array
- vec.push_back(1); // push something back to the vector
- vec.pop_back(); // pop something back out of the vector
- cin >> vec.at(2); // like arr[2]
- cout << vec[2] << endl; // or use square bracket
- stack<int> sta;
- queue<int> que;
- deque<int> dq; // sound like /dik'iu/
- priority_queue<int> pq; // some container adapter using vector
- set<int> se; // a set
- multiset<int> mse; // a multi-set
- se.insert(3); // insert something in the set
- se.erase(3); // delete something out of the set
- se.count(3); // if found 3 in the set, return 1; else return 0
- int arr[100],n=10;
- vector<int> ve;
- sort(arr,arr+n); // sort the array arr[0]~arr[n-1] in increasing order
- sort(arr,arr+n,greater<int>) // decreasing order
- sort(ve.begin(),ve.end()) // vector sorting
- pair<int,int> pii; // a pair, just a pair
- cin << pii.first << pii.second;
- cout << pii.second;
- /// ** Don't forget to add ';' at the end of the statement **
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement