C++ programming. i need help !

• Feb 21st 2013, 05:33 PM
Riana
C++ programming. i need help !
At Chips Fast Food emporium there is a very simple menu. Each food item is selected by entering a digit choice.
Here are the three burger choices: Here are the three drink choices:
1  Cheeseburger (461 Calories) 1  Soft Drink ( 130 Calories)
2  Fish Burger (431 Calories) 2  Orange Juice (160 Calories)
3  Veggie Burger (420 Calories) 3  Milk (118 Calories)
4  no burger 4  no drink
Here are the three side order choices: Here are the three dessert choices:
1  Fries (100 Calories) 1  Apple Pie (167 Calories)
2  Baked Potato (57 Calories) 2  Sundae (266 Calories)
3  Chef Salad (70 Calories) 3  Fruit Cup (75 Calories)
4  no side order 4  no dessert
Write a program that will compute the total Calories of a meal.
Input Specifications
The program should prompt the user for a number for each type of item then calculate and display the Calorie total. You may assume that each input will be a number from 1 to 4. That is, each customer has to pick exactly one number from each of the four options out of each of the four categories.
Output Specifications
The program prints out on the screen the total Calories of the selected meal, and stops executing
after this output.
Sample Prompting and User Input (user input in italics)
Welcome to Chips Fast Food Emporium
Please enter a burger choice: 2
Please enter a side order choice: 1
Please enter a drink choice: 3
Please enter a dessert choice: 4
Output for the Sample
Your total Calorie count is 649.

above is the question and below is my half code so far....i can't further do anything.......i can't under stand what should i do?

#include <iostream>

using namespace std;

int main()
{
int b,d,o,s;
int a=
int sum=0;
cout<<"Welcome to Chip's Fast Food Emporium"<<endl;
cin>>b;
cout<<"Please enter a side order choice:"<<endl;
cin>>o;
cin>>d;
cin>>s;

return 0;
}
• Feb 21st 2013, 08:18 PM
jakncoke
Re: C++ programming. i need help !
Create an 4 arrays that store the calories, one for burger, one for side, one for drink and one for dessert.

If the user picks the 5th option for burger, this corresponds to the 4th index of your burger array( since index start with 0).

So if you had an array Burger and the user input to get burger choice was stored in a variable.
Type cast that variable to an int, and - 1 and use this as an index Burger[input - 1] to get the calories for that choice.
• Feb 22nd 2013, 05:35 PM
Riana
Re: C++ programming. i need help !
can you type the code for arrays...cause i hav no idea what you talking about?
• Feb 22nd 2013, 06:32 PM
jakncoke
Re: C++ programming. i need help !
#include <iostream>

using namespace std;

int main()
{
int burgerCalories [] = {461,431};
int sideOrder [] = {100,57};
int drink [] = {130,160};
int dessert [] = {167,266};

int burgerChoice,sideOrderChoice,drinkChoice,dessertCh oice;
int totalCalories;

cin>>burgerChoice;

cin>>sideOrderChoice;