Advertisement
informaticage

Vector simple use

Feb 5th, 2021
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3.  
  4. using namespace std;
  5.  
  6. int main ( ) {
  7.     int N;
  8.     cout << "N: ";
  9.     cin >> N;
  10.  
  11.     vector<int> V(N);
  12.  
  13.     cout << "V size: " << V.size() << endl;
  14.  
  15.     for(int i = 0; i < V.size(); i++) {
  16.         cout << V[i] << " ";
  17.     }
  18.  
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement