This is what I have on my program so far. I do not know what to do next.

Thanks alot,
Kilo

// Write a program to help a local restaurant automate its breakfast billing
//system.  Show the customer the different breakfast itmes offered by the 
//restaurant.  Allow the customer to select more than one item from the menu. 
//Calculate and print the bill.
#include <iostream>
#include <fstream>
#include <string>


using namespace std;

struct menuList                 //Define struct menuList with members
{
       string Eggs;
       string BaconandEggs;
       string Muffin;
       string FrenchToast;
       string FruitBasket;
       string Cereal;
       string Coffee;
       string Tea;
       string price:
};
void getData();
void showMenu();
void printcheck();
int main()
{
       menuList menuItemType;    // declare variable

       void getData();
       menuItemList.Eggs;          //Access a struct member components
       menuItemList.BaconandEggs;
       menuItemList.Muffins; 
       menuItemList.FrenchToast;
       menuItemList.FruitBasket;
       menuItemList.Cereal;
       menuItemList.Coffee;
       menuItemList.Tea;
       menuItemList.price = 0.0;

       void showMenu();
       cin >> menuItemType.Eggs >> menuItemType.BaconandEggs;
       cin >> menuItemType.Muffin;
       cin >> menuItemType.FrenchToast;
       cin >> menuItemType.FruitBasket;
       cin >> menuItemType.Cereal;
       cin>> menuItemType.Coffee;
       cin >> menuItemType.Tea;



       void printCheck();



     system("PAUSE");
    return EXIT_SUCCESS;
}

Recommended Answers

All 4 Replies

1. where is menuItemList object declared?

2. why all those useless lines that access the structure but does nothing with them? For example: menuItemList.BaconandEggs; If it is supposed to be setting them to 0 -- it doesn't.

struct menuList //Define struct menuList with members
{
string Eggs;
string BaconandEggs;
string Muffin;
string FrenchToast;
string FruitBasket;
string Cereal;
string Coffee;
string Tea;
string price:
};

What are these variables supposed to contain? I suspect that you do not want to write out your complete menu in a struct, that would achieve very little except for a very long tedious program.
Remember: a struct is like a template for the type of information you want to store - Do not pre-empt the actual data it is going to contain!

Also, I suspect you want to use a numerical type for price.

void getData();
void showMenu();
void printcheck();

OK - here you have 3 forward declarations of functions, but their definitions are inside your main() function - this is wrong, they must be declared outside main(), either before or after it.

menuItemList.Eggs; //Access a struct member components

This line is doing nothing, letalone accessing anything, what do you intend this line to do?

menuItemList.price = 0.0;

This is an error. assuming you mean "menuItem price" - its a string - you must change price to float, or preferably, double to do this.

void showMenu();
cin >> menuItemType.Eggs >> menuItemType.BaconandEggs;
cin >> menuItemType.Muffin;
cin >> menuItemType.FrenchToast;
cin >> menuItemType.FruitBasket;
cin >> menuItemType.Cereal;
cin>> menuItemType.Coffee;
cin >> menuItemType.Tea;

I Already mentioned that this function must be declared outside main(). Aside from that - What are you asking your users to input? The name "ShowMenu" is very misleading and confusing - it doesn't show or output anything!
Quite the opposite, in fact - it asks for user input. Maybe GetMenuContents() would be a more appropriate name here.


think more carefully about the actual data you wish to store. storing price or other numerical information in a string is quite useless.

I suspect you'd be better of re-designing your data structures. In real terms, every item on a restaurant menu is a seperate entity with unique properties. These entities do not share any information with each another, so why relate them in a struct?

struct MenuEntry
{
  std::string name;
  double price;
}

A menu is a collection or list of all these entities. a C++ container such as "list" or "vector", would be well suited to the task of grouping all your entries together, and forming your Menu.

i have a case study....
my prof said that we should display 10 random numbers without reaping the same number for example the screen will print numbers from 0-9 at this order

1 6 7 5 2 3 4 9 8 0

then when we exit the program it should pritn another random number... plss help i needed it very badly :sad: :sad: :sad:

tanx...

i have a case study....
my prof said that we should display 10 random numbers without reaping the same number for example the screen will print numbers from 0-9 at this order

1 6 7 5 2 3 4 9 8 0

then when we exit the program it should pritn another random number... plss help i needed it very badly :sad: :sad: :sad:

tanx...

OK... so, show us how far you've gotten with your program...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.