1110.求数组或vector元素最大最小值
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int arr[6] = {8,1,5,2,90,11};
vector<int> vec;
vec.push_back(80);
vec.push_back(81);
vec.push_back(91);
vec.push_back(33);
vec.push_back(21);
cout << "minvec: " << *min_element(vec.begin(),vec.end()) << endl;
cout << "maxvec: " << *max_element(vec.begin(),vec.end()) << endl;
cout << "min: " << *min_element(begin(arr),end(arr)) << endl;
cout << "min: " << *max_element(begin(arr),end(arr)) << endl;
return 0;
}
输出如下: