找不出问题
#include"stdlib.h"
#include"iostream"
using namespace std;
namespace A
{
Getmaxormin(int a[],int n,bool ismax)
{
int temp=a[0];
for(int i=1;i<n;i++)
{
if(ismax)
{
if(temp<a[i])
temp=a[i];
}
else
{
if(temp>a[i])
temp=a[i];
}
}
return temp;
}
}
int main(void)
{
int a[5]={5,3,4,6,2,};
bool ismax=false;
cout<<"请输入你要找的是最大值(1)还是最小值(0)"<<endl;
cin>>ismax;
cout<<A::Getmaxormin(a,5,ismax)<<endl;
system("pause");
return 0;
}