min element c++

#include <iostream>
#include <algorithm>
#include <vector>

int main() {
    // Step 1: Declare a vector of integers
    std::vector<int> numbers = {4, 2, 8, 5, 1};

    // Step 2: Use the std::min_element algorithm to find the minimum element
    auto minElement = std::min_element(numbers.begin(), numbers.end());

    // Step 3: Check if the minimum element was found
    if (minElement != numbers.end()) {
        // Step 4: Output the minimum element
        std::cout << "The minimum element is: " << *minElement << std::endl;
    } else {
        // Step 5: Handle the case where the vector is empty
        std::cout << "The vector is empty." << std::endl;
    }

    return 0;
}