📜  向量与 pinter cout c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:52.112000             🧑  作者: Mango

代码示例1
#include 
#include 

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

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

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

    printVectorElements(&str_vec);

    return EXIT_SUCCESS;
}