I am probably doing something either terribly wrong or it's just something that requires a simple fix. I know I need to find at least 4 employees that don't match the employees in the class one array. But I get absolutely no output.
int ClassOne::binSearch(int employee)
{
int first, last, mid, found;
first = 0;
last = empCount - 1;
found = 0;
while(first <= last && found == 0)
{
mid = (first + last) / 2;
if(ids[mid] == employee)
found = 1;
else if(eids[mid] < employee)
first = mid + 1;
else if(ids[mid] > employee)
last = mid - 1;
}
if(found == 0)
mid = -1;
return mid;
}
void ClassTwo::pay()
{
int employee, location;
classOneArray.loadArrays();
classOneArray.bubbleSort();
for(int i = 0; i < idCount; ++i)
{
employee = payIds[i];
while(i < idCount)
{
location = classOneArray.binSearch(employee);
if(location >= 0)
{
for(int i = 0; i < idCount; ++i)
{
goodIds[i] = employee;
}
}
else
{
for(int i = 0; i < idCount; ++i)
{
cout << "Employee " << employee << " not found!" << endl;
badIds[i] = employee;
}
}
}
}
}