Im trying to make my program so that after the user chooses an item to purchase they aren't able to choose it again. I tried using bool to make this work but when I run the code I am still able to choose the first item over and over again.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
case 1:
{
if (bool item1 = false)
cout << "Item is no longer available!" << endl;
elseif (currency >= price1)
{
cout << "Thank You!" << endl;
cout << "*You purchased the beanie for $10.*" << endl << endl;
item1 = "Not Available";
currency = currency - price1;
available--;
bool item1 = false;
}
else
cout << "Sorry, you do not have enough currency to purchase this item." << endl;
break;
}
Line 12 I was trying to set the variable to false so that when this loop runs again and the user chooses item 1 again the first if statement will run and not let them purchase it again