#include <iostream>
#include <vector>

using namespace std;

int main() {
    
    // Declare two empty vectors
    vector <int> vector1;
    vector <int> vector2;
    
    // Add 10 and 20 to vector1 dynamically using 'push_back'
    vector1.push_back(10);
    vector1.push_back(20);
    
    // Display the elements in vector1 using the 'at()' method
    cout << "The elements in vector1 are:\n\n";
    cout << vector1.at(0) << endl;
    cout << vector1.at(1) << endl;
    
    // Display the size of vector1 using the 'size()' method
    cout << "\nThe size of vector1 is currently " << vector1.size() << endl;
    
    // Add 100 and 200 to vector2 dynamically using 'push_back'
    vector2.push_back(100);
    vector2.push_back(200);
    
    // Display the elements in vector2 using the 'at()' method
    cout << "\nThe elements in vector2 are:\n\n";
    cout << vector2.at(0) << endl;
    cout << vector2.at(1) << endl;
    
    // Display the size of vector2 using the 'size()' method
    cout << "\nThe size of vector2 is currently " << vector2.size() << endl;
    
    // Declare an empty 2d vector called vector_2d
    vector <vector<int>> vector_2d;
    
    // Add vector1 and vector2 to vector_2d using 'push_back'
    vector_2d.push_back(vector1);
    vector_2d.push_back(vector2);
    
    // Display the elements in vector_2d using the 'at()' method
    cout << "\nThe elements in vector2d are:\n\n";
    cout << vector_2d.at(0).at(0) << endl;
    cout << vector_2d.at(0).at(1) << endl;
    cout << vector_2d.at(1).at(0) << endl;
    cout << vector_2d.at(1).at(1) << endl;
    
    // Change vector1.at(0) to 1000
    cout << "\nChange the value in vector[0] to 1000.\n";
    vector1.at(0) = 1000;
    
    // Display the elements in vector_2d again using the 'at()' method
    cout << "\nThe elements in vector2d are now:\n\n";
    cout << vector_2d.at(0).at(0) << endl;
    cout << vector_2d.at(0).at(1) << endl;
    cout << vector_2d.at(1).at(0) << endl;
    cout << vector_2d.at(1).at(1) << endl;

    // Display the element in vector1
    cout << "\nDisplay the elements in vector1:\n";
    cout << vector1.at(0) << endl;
    cout << vector1.at(1) << endl;
    
    /*
     * Notes
     * We changed the value of vector1[0] to 1000, this does not update the value that was PREVIOUSLY assigned when vector1 was added to vector_2d.
     * This makes complete sense.
     * If we wanted vector_2d to have the updated value we would have to update vector_2d separately as well.
     */
    
    cout << endl;
    
    return 0;
    
}
