stl in c++

#include <iostream>      // Step 1: Include necessary header files
#include <vector>        //         for standard input/output and STL containers

using namespace std;

int main() {             // Step 2: Define the main function

    vector<int> numbers; // Step 3: Declare a vector container of integers

    // Step 4: Populate the vector with elements
    for (int i = 1; i <= 5; ++i) {
        numbers.push_back(i);
    }

    // Step 5: Access and print elements of the vector
    cout << "Vector elements: ";
    for (int i = 0; i < numbers.size(); ++i) {
        cout << numbers[i] << " ";
    }
    cout << endl;

    // Step 6: Use iterator to access and print elements
    cout << "Using iterator: ";
    for (auto it = numbers.begin(); it != numbers.end(); ++it) {
        cout << *it << " ";
    }
    cout << endl;

    // Step 7: Perform some operations on the vector
    cout << "Vector size: " << numbers.size() << endl;
    cout << "Is vector empty? " << (numbers.empty() ? "Yes" : "No") << endl;

    // Step 8: Clear the vector
    numbers.clear();

    // Step 9: Check if the vector is empty after clearing
    cout << "Is vector empty after clearing? " << (numbers.empty() ? "Yes" : "No") << endl;

    return 0;             // Step 10: Return 0 to indicate successful execution
}