#include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> vec = {3, 8, 1, 5, 7};
// Find the maximum element in the vector
auto maxElement = std::max_element(vec.begin(), vec.end());
// Check if the vector is not empty before accessing the maximum element
if (maxElement != vec.end()) {
int maxValue = *maxElement;
// Output the maximum value
std::cout << "The maximum value in the vector is: " << maxValue << std::endl;
} else {
// Handle the case where the vector is empty
std::cout << "The vector is empty." << std::endl;
}
return 0;
}