#include #include using namespace std; int main(){ cout << endl<< "*** This program tests some of the default declarations of vector containers, for the built in types and the string type. In this version we use iterators! ****" << endl<< endl; cout << "Declaration using the constructor which initialises a vector of integers with 3 copies of value 1" << endl; vector v1(3,1); for(vector::iterator iter=v1.begin(); iter!=v1.end();iter++){ cout << *iter<< "\t"; } cout<< endl; cout << "Now the value of an element is changed..."<< endl; v1[1]=400; for(vector::iterator iter=v1.begin(); iter!=v1.end();iter++){ cout << *iter<< "\t"; } cout<< endl; cout << "Declaration using the constructor which initialises the size of the vector of integers and gives each component the default initial value" << endl; vector v2(4); for(vector::iterator iter=v2.begin(); iter!=v2.end();iter++){ cout << *iter<< "\t"; } cout<< endl; cout << "Same as previous example but we initialise a vector of bool variables and check what the default initial values is (false as you can check)" << endl; vector FalseOrTrue(10); for(vector::iterator iter=FalseOrTrue.begin(); iter!=FalseOrTrue.end();iter++){ cout << *iter<< "\t"; } cout<< endl; }