I'm attempting to find a value through a binary search, but i keep getting an error of error: no match for 'operator==' in '(& itemNumb)->std::vector<_Tp, _Alloc>::operator[], std::allocator > >(((std::vector >::size_type)middle)) == value'| I already have the vector sorted an am completely unsure of what caused the error.
void Search(vector<string>& itemNumb, vector<string>& itemName, vector<double>& itemCost, vector<int>& itemQuant)
{
int left, right, value, middle;
left = 0;
right = itemNumb.size();
cout << "Please enter desired item number." << endl;
cin >> value;
while (left <= right)
{
middle = ((left + right) / 2);
if (itemNumb[middle] == value)
{
cout << "Item is " << itemName[middle] << endl;
cout << "Price is " << itemCost[middle] << endl;
cout << "Amount in stock is " << itemQuant[middle] << endl;
}
else if (itemNumb[middle] > value)
{
right = (middle - 1);
}
else
{
left = (middle + 1);
}
}
if (intNumb[middle] != value)
{
cout << "Item number not found." << endl;
}
}
Each if statement is giving the same error, just with "operator==" or "operator>" in order. Any help at all would be wonderful, i'm at my wit's end trying to figure this out, pretty new to c++.