题解 | #获取数组最值#
获取数组最值
https://www.nowcoder.com/practice/53d110f6cdd14f21af285698f975b59c
#include <bits/stdc++.h> using namespace std; int main() { int arr[6]; int len = sizeof(arr) / sizeof(int); for (int i = 0; i < len; i++) { cin >> arr[i]; } // write your code here...... sort(arr,arr+6); cout<<arr[0]<<" "<<arr[5]; return 0; }
排个序,输出首尾;