输入输出问题
#include<iostream>;
#include<stdlib.h>;
using namespace std;
int getMaxOrMin(int *arr, int count, bool isMax){
int temp = arr[0];
for (int i = 1; i < count; i++){
if (isMax){
if (temp < arr[i]){
temp = arr[i];
}
else{
if (temp > arr[i]){
temp = arr[i];
}
}
}
return temp;
}
}
int main(void){
int arr1[4] = {9, 4, 8, 3};
bool isMax = false;
cin >> isMax;
cout << getMaxOrMin(arr1, 4, isMax) << endl;
system("pause");
return 0;
}
请问为什么我输入0 它输出9 ,我输入1 它输出4
错在哪呀