I have an array with size 10. I allow the user to enter in a product code and if the product code matches one in the array it will tell them the price of that product. On the other hand, if the product code is not found I want it to tell them the product was not found. Im' not sure what the problem is. Here is my code.
1 2 3 4 5 6 7 8 9 10 11 12 13
for(int sub=0; sub < SIZE; sub++)
{
if(userCode == codes[sub])
{
price = prices[sub];
cout << "The price for Product Code " << userCode << " is: " << price;
}elseif (userCode != codes[sub] && (sub+1) == SIZE)
{
cout << "Product code not found";
break;
}
}