I can't figure out what's wrong with this block of code, I don't see any errors. The program runs but skips this whole block for some reason, obviously theres more code than this such as my declarations, arrays, and outputs. This seems to be the issue though, any ideas?
1 2 3 4 5 6 7 8 9 10 11 12
if(choice != -1)
{
if ((choice >= 1) and (choice <= 5))
{
totalPrice = totalPrice + prices[choice - 1];
cout << "Item number ", choice, ": ", products[choice - 1], "has been added.";
}
else
cout << "Item number ", choice, " is not valid", "Sorry we do not carry that item";
}
totalPrice = totalPrice + COFFEEPRICE;
something to add, I have these two arrays, and int SIZE = 5;
Thanks for the reply, I had actually just changed that before you commented, but when I type 6 for example it should throw the error in the else, but it doesn't.