Альтернативный способ найти MAX и MIN в векторе: * max_element (first_index, last_index); * min_element (first_index, last_index);
EX: вектор a = {1, 45, 54, 71, 76, 12};
// Print the vector
cout << "Vector: ";
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
// Find the max element
cout << "\nMax Element = "
<< *max_element(a.begin(), a.end()); // Max = 76