I'm currently trying to make a sort of a shopping cart. When the program asks for items, i type them in; but it needs to remember the values so it can use them later in the code.
I have this code so far:
#include <iostream>
int main() {
int item{};
int apple = 5;
std::cout << "what item do you want to buy?";
std::cin >> item;
std::cout << item;
return 0;
}
Can I make it so that when i type apple
as input, item
actually gets the value 5
, from the variable named apple
? With this code, I get 0
as the result.