#include <algorithm>
#include <vector>
#include <iostream>
int main ()
{
using namespace std;
vector <int> v (3);
// fill all elements in the container with value 9
fill (v.begin (), v.end (), 9);
cout << "Contents of the vector are: " << endl;
for (size_t nIndex = 0; nIndex < v.size (); ++ nIndex)
{
cout << "Element [" << nIndex << "] = ";
cout << v [nIndex] << endl;
}
return 0;
}
|