Hello there
this is my first post, i'm a beginner in c++
I'm making a project about restaurant in c++ and i'm having a problem
i want the customer to enter how many meals he wants to order then enter the meal number he wants to order
after that the program will take the value that i assigned to each meal and make a bill to it then inputs the bill only
the program runs and shows the menu , but after i enter a meal number it doesn't do anything
this is the code i tried making:
using MS visual studio 2010 express
string meals[ITEMS] = {"omlete", "crepe", "pancakes","doughnuts", "zaatar_croissant" , "cheese_croissant"};
int prices[ITEMS] = {16,28,10,4,8,11};
int orders[ITEMS] = {0};
Every meal and corresponding price has the same index in their respective arrays.
Now
1 2 3 4 5 6 7 8 9 10
for(int i = 0; i < n; i++)
{
cout<<"Enter item "<<i+1<<" : ";
cin>>orderNum; //Enter order Numer. (e.g 4)
totalCost += prices[orderNum-1]; //adding the price of each meal to the total cost
/* since 4 is doughnuts which is in index 3 of the meals array, then the prices is also in index 3 of the price array.
so you add its price to the total price.
*/
orders[orderNum -1] = 1; //to keep track of the meals ordered.
}
Do you acutally have a problem understanding the code totalCost += prices[orderNum-1]; or the its implementation in this problem??