Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. void print_vector(vector<int> v)
  7. {
  8.     for (int i = 0; i < v.size(); i++)
  9.     {
  10.         cout << v[i] << " ";
  11.     }
  12.     cout << endl;
  13. }
  14.  
  15.  
  16. int main(int argc, const char * argv[]) {
  17.     int n, x;
  18.     cin >> n;
  19.     vector<int> v;
  20.     for (int i = 0; i < n; i++)
  21.     {
  22.         cin >> x;
  23.         v.push_back(x);
  24.         print_vector(v);
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement