在C++中,可以使用STL中的min_element函数来输出最小值。这个函数需要在#include <algorithm>头文件中使用。下面是一个示例代码:
#include <iostream>#include <algorithm>#include <vector>int main() { std::vector<int> numbers = {4, 2, 7, 1, 9, 5}; auto min_value = *std::min_element(numbers.begin(), numbers.end()); std::cout << "The minimum value is: " << min_value << std::endl; return 0;}运行上面的代码,将会输出数组numbers中的最小值。


