#include #include using namespace std; #include "tvector.h" void display_size_capacity(const tvector & v) //post: displays the size and capacity of a vector { cout << "size is " << v.size() << " and the capacity is " << v.capacity() << endl; } void print (const tvector & v) { int i; for (i=0; i < v.size(); i++) { cout << v[i] << endl; } } int main() { //tvector words; //cout << "created an empty vector: "; //display_size_capacity(words); tvector words(5); cout << "created a vector with 5 elements: "; display_size_capacity(words); // words.reserve(5); // cout << "reserved 5 words: "; // display_size_capacity(words); string str; while (cin >> str) { words.push_back(str); cout << "added " << str << ": "; display_size_capacity(words); } print (words); display_size_capacity(words); return 0; }