Advertisement
rozman50

Untitled

Jun 12th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. template <typename T>
  8. void printVector(std::vector<T> &vec) {
  9. for (auto &el : vec) {
  10. cout << el << endl;
  11. }
  12. cout << "- " << endl;
  13. for (int i = 0; i < vec.size(); i++) {
  14. cout << vec[i] << endl;
  15. }
  16. }
  17.  
  18. int main()
  19. {
  20. vector<int> vec = { 1, 2, 3, 4, 1, 3, 5 };
  21. vector<double> vecD = { 5.3, 2.1, 2.3 };
  22. printVector(vec);
  23. printVector(vecD);
  24.  
  25. std::cout << "Hello World!\n";
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement