dzungchaos

C++ "VD Vector"

Jan 15th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main(){
  6.     vector<int> v;
  7.     for(int i = 0; i < 5; i++){
  8.         v.push_back(i);
  9.     } //v = [0, 1, 2, 3, 4]
  10.     v.push_back(10); //v = [0, 1, 2, 3, 4, 10]
  11. //  cout << v[5] << " " << v[3];
  12.     for(int i = 0; i < v.size(); i++){
  13.         cout << v[i] << " ";
  14.     }
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment