Advertisement
Josif_tepe

Untitled

Feb 5th, 2023
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <cmath>
  5. #include <set>
  6. #include <array>
  7. using namespace std;
  8.  
  9. void f(vector<int> & v) {
  10.     for(int i = 0; i < v.size(); i++) {
  11.         v[i] = 2;
  12.     }
  13. }
  14.  
  15. int main() {
  16.    
  17.    
  18.     vector<int> v = {1, 2, 3, 4};
  19.    
  20.     f(v);
  21.    
  22.     for(int i = 0; i < v.size(); i++) {
  23.         cout << v[i] << " ";
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement