I'm trying to make a simple bool function that can check if there are any duplicates in a string array. below is what i wrote but shows abort()has been called error message when there are duplicates
1 2 3 4 5 6 7 8 9 10 11 12 13 14
bool noDup(const string arr[], int n) { //need to be fixed
bool result = true;
if (n < 0) result = false;
elseif (n == 0) result = true;
else {
for (size_t i=0; i < n; i++) {
for (size_t k = 0; k < n; k++) {
if (i!=k && arr[i] == arr[k]) result = false;
}
}
}
return result;
}