#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<char> vectorObject;
int i;
for(i = 0; i <10; i++)
vectorObject.push_back(i + 'A');
cout << "Vector's original contents:\n";
for(i = 0; i <vectorObject.size(); i++)
cout << vectorObject[i] << " ";
cout << "\n\n";
do {
vectorObject.pop_back(); // remove an element from the end
cout << "Vector now contains:\n";
for(i = 0; i <vectorObject.size(); i++)
cout << vectorObject[i] << " ";
cout << endl;
} while(!vectorObject.empty());
return 0;
}
|