#include<stdlib.h>
#include<iostream>
using namespace std;
int getMaxOrMin(int *arr,int count, bool isMax)
{
int temp = arr[0];
for(int i = 0; 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 arr[4] = {3,5,1,7};
bool inMax = false
cin >> isMax;
cout << getMaxOrMin(arr1,4,isMax) << endl;
system("pause");
return 0;
}
一束会飞的光
相关分类