Example:
//Items, Amount
Apple,orange, Mango=10
Potato, bag of Carrot, Radish= 20
Coke, Fanta, Can of Pepsi=5
Cookie, bread = 5
(Always all fruits are assigned
10,Vegies are 20 and so on)
Different items will be inputted by user like orange, Mango, bread etc..How to group similar items from input and store it somewhere and assign Amount like above.
For example if i store it in a
std::Map with Items being key and
Amount being value, It will store
as below
Apple =10
Orange =10
Coke=5 and goes on and on.
I will get customer input as 'Coke' where i will access this map and get the Amount of it and do something with it.
Is there any better way to group same category first and assign the amount to it and access it.