Hey everyone. I've been hacking away at this assignment for the past 2 weeks and I just can't frickin get it. I have a restaurant menu (two arrays in a struct) and I am supposed to be able to list all items and prices (this part works fine) and then I'm supposed to be able to choose any individual item to add to an order. So for example if someone wants eggs, I input 0, if someone wants french toast I input "3" and so on. Then when the person is done ordering, I need to add the total and print the bill.
In my code I have the input as a for loop, but I can't figure out how to do it. I keep adding up numbers that are not referencing the array. Please help! Sorry I didn't use code tags, they never seem to work, but this is what I have so far.
using namespace std;
dish.breakfastItem= "0. Plain Eggs -- $1.45\n";
dish.breakfastItem= "1. Bacon and Eggs -- $2.45\n";
dish.breakfastItem="2. Muffin -- $0.99\n";
dish.breakfastItem="3. French Toast -- $1.99\n";
dish.breakfastItem="4. Fruit Basket -- $2.46\n";
dish.breakfastItem="5. Cereal -- $0.69\n";
dish.breakfastItem= "6. Coffee -- $0.50\n";
dish.breakfastItem="7. Tea -- $0.75\n";
for(int i=0; i<=7;i++)
cout << dish.breakfastItem;
cin >> dish.itemPrice[j];
sum = sum + dish.itemPrice[j];
cout << sum;
Help with a "restuarant menu"
Post a Reply
Replies- page 2
|Oldest Newest Rating|
· December 1, 2015
See, this is where I want to light my C++ book on fire. I've been working on my code for the past 2 weeks because someone in my class was helping me build it the way I showed you (until I got stuck). He knows what he's doing, he's a programmer, he'd make it work. Then suddenly everything I'm doing is wrong. What do I do about that?
and that's alright Dan. I appreciate the help. Now I'm gonna have to wipe my brain and go over everything new and everything I thought I knew and bleh...this is hard.
· December 1, 2015
okay, i need you to clarify what you mean by this. is the "other variable" the sum of the bill and the value  an item on the menu?
you wish to add the price of the chosen item on the menu to the bill amount, correct?
· December 2, 2015
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|