运行时总报错:fatal error LNK1169: 找到一个或多个多重定义的符号
#include<iostream>
#include <stdlib.h>
using namespace std;
namespace CompA
{
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] = {3,5,1,7};
bool isMax = false;
cin >> isMax;
cout << CompA::getMaxOrMin(arr1,4,isMax) << endl;
system("pause");
return 0;
}