Using Vectors as Examples of Container Classes - C++ template

C++ examples for template:template class

Description

Using Vectors as Examples of Container Classes

Demo Code

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()/*from  www  .  ja v a  2s. c o  m*/
{
    vector<string> names;

    names.push_back("A");
    names.push_back("B");
    names.push_back("C");
    names.push_back("D");
    names.push_back("E");
    names.push_back("F");

    cout << names[0] << endl;
    cout << names[5] << endl;

    return 0;
}

Result


Related Tutorials