Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <vector>
- using namespace std;
- template <typename T>
- void printVector(std::vector<T> &vec) {
- for (auto &el : vec) {
- cout << el << endl;
- }
- cout << "- " << endl;
- for (int i = 0; i < vec.size(); i++) {
- cout << vec[i] << endl;
- }
- }
- int main()
- {
- vector<int> vec = { 1, 2, 3, 4, 1, 3, 5 };
- vector<double> vecD = { 5.3, 2.1, 2.3 };
- printVector(vec);
- printVector(vecD);
- std::cout << "Hello World!\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement