fork download
  1. #include<iostream>
  2. #include<vector>
  3. #include<utility>
  4. #include<iterator>
  5.  
  6. using namespace std;
  7. void printVec(auto/*vector<int>*/ fv){
  8. for(int &var : fv){
  9. cout << var << " ";
  10. }
  11. cout << endl;
  12. }
  13.  
  14.  
  15. void printVecUsingIt(vector<int> fv){
  16. //vector<int>::iterator it1;
  17. for(auto it1 = fv.begin();it1 != fv.end();++it1){
  18. cout << *(it1) << " ";
  19. }
  20. cout << endl;
  21. }
  22.  
  23. int main(){
  24. vector<int> v1 = {1,2,3,5};
  25. printVec(v1);
  26. printVecUsingIt(v1);
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
1 2 3 5 
1 2 3 5