1  #include <iostream>
  2  #include <vector>
  3  #include <string>
  4  using namespace std;
  5  
  6  int main()
  7  {
  8    vector<int> intVector;
  9  
 10    // Store numbers 1, 2, 3, 4, 5, ..., 10 to the vector
 11    for (int i = 0; i < 10; i++)
 12      intVector.push_back(i + 1);
 13  
 14    // Display the numbers in the vector
 15    cout << "Numbers in the vector: ";
 16    for (int i = 0; i < intVector.size(); i++)
 17      cout << intVector[i] << " ";
 18  
 19    vector<string> stringVector;
 20  
 21    // Store strings into the vector
 22    stringVector.push_back("Dallas");
 23    stringVector.push_back("Houston");
 24    stringVector.push_back("Austin");
 25    stringVector.push_back("Norman");
 26  
 27    // Display the string in the vector
 28    cout << "\nStrings in the string vector: ";
 29    for (int i = 0; i < stringVector.size(); i++)
 30      cout << stringVector[i] << " ";
 31  
 32    stringVector.pop_back(); // Remove the last element
 33  
 34    vector<string> v2;
 35    v2.swap(stringVector);
 36    v2[0] = "Atlanta";
 37  
 38    // Redisplay the string in the vector
 39    cout << "\nStrings in the vector v2: ";
 40    for (int i = 0; i < v2.size(); i++)
 41      cout << v2.at(i) << " ";
 42  
 43    return 0;
 44  }