题解 | #获取数组最值#
获取数组最值
https://www.nowcoder.com/practice/53d110f6cdd14f21af285698f975b59c
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
using namespace std;
int main() {
vector<int> arr(6, 0);
for (int i = 0;i < arr.size();i++) {
int n;
cin >> n;
arr.at(i) = n;
}
auto res = minmax_element(arr.begin(), arr.end());
cout << *res.first << " " << *res.second;
// cout << *res.first << " " << *res.second << endl;
// write your code here......
return 0;
}