在“if (size == list[i])”处,“==”上用红色标记,表示No operator "==" matches these operands operand types are: int == InventoryRecord. 我没有看到我在这里做错了什么。有人可以向我解释为什么会这样吗?
void linear_search(InventoryRecord list[], int size) {
int i;
cout << "\nEnter Element to Search : ";
cin >> size;
/* for : Check elements one by one - Linear */
for (i = 0; i < MAX_SIZE; i++) {
/* If for Check element found or not */
if (size == list[i]) {
cout << "\nLinear Search : Element : " << size << " : Found : Position : " << i + 1 << ".\n";
break;
}
}
if (i == MAX_SIZE)
cout << "\nSearch Element : " << size << " : Not Found \n";
}