Advertisement
dllbridge

Untitled

Nov 25th, 2021
916
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #include <vector>
  4. using namespace std;
  5.  
  6.  
  7. ///////////////////////////////////////////////////////
  8. int main()                                           //
  9. {
  10.  
  11.     vector<int> v;
  12.  
  13.     printf("size of vector = %d \n", v.size());
  14.  
  15.  
  16.     for(int i = 1; i < 10; i++)
  17.     {
  18.  
  19.         v.push_back(i);
  20.  
  21.     }
  22.  
  23.  
  24.     printf("size of vector = %d \n", v.size());
  25.  
  26.     v.pop_back();
  27.     v.pop_back();
  28.     printf("size of vector = %d \n", v.size());
  29.  
  30.  
  31.  
  32.     for(int i = 0; i < v.size(); i++)
  33.     {
  34.  
  35.         printf("v[%d] = %d \n", i, v[i]);
  36.  
  37.     }
  38. }
  39.  
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement