Horje
vector with pinter cout c++ Code Example
vector with pinter cout c++
#include <iostream>
#include <vector>

using std::cout; using std::cin;
using std::endl; using std::string;
using std::vector;

template<typename T>
void printVectorElements(vector<T> *vec)
{
    for (auto i = 0; i < vec->size(); ++i) {
        cout << vec->at(i) << "; ";
    }
    cout << endl;
}

int main() {
    vector<string> str_vec = {"bit", "nibble",
                              "byte", "char",
                              "int", "long",
                              "long long", "float",
                              "double", "long double"};

    printVectorElements(&str_vec);

    return EXIT_SUCCESS;
}




Cpp

Related
fibonacci series in c++ Recursive Code Example fibonacci series in c++ Recursive Code Example
unordered_map of pair and int Code Example unordered_map of pair and int Code Example
initialize vector to all zeros c++ Code Example initialize vector to all zeros c++ Code Example
web scraping with cpp Code Example web scraping with cpp Code Example
c++ is string a number Code Example c++ is string a number Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7