题解 | #获取数组最值#
获取数组最值
https://www.nowcoder.com/practice/53d110f6cdd14f21af285698f975b59c
最快方法 || 无需排序
#include <iostream> using namespace std; int nums[6]; int maxn=0,minn=0; int main() { for(int i=0;i<6;i++){ cin >> nums[i]; if(i==0) minn=nums[i]; maxn= maxn>nums[i]? maxn : nums[i]; minn= minn<nums[i]? minn : nums[i]; } cout << minn << " " << maxn; }