****I'm stuck as to what my next step should be?? I also want to know if I'm on the right track. I've tried searching for some type of sample program as I am sure there are plenty, but when I start to write it doesn't seem to make sense. Any sort of help is appreciated. Thank you.


Write a program to help a cafe automate its breakfast billing system. The program should do the following:
• Show the customer the different breakfast items offered by the restaurant. The items are in a file so it can easily be changed. The name of the file is MenuData.txt.
• Allow the customer to select more than one item from the menu.
• Calculate and print the bill.
Use a struct called menuItemType that has the follwing members: a string called menuItem and a double called menuPrice.
Use an array called menuList to store the menu which is read in from the file. Use a constant global variable to set the number of items in the menu so it can easily be changed if the number of items changes.
The program must contain the following functions:
• getData: Load the data from the file into the array menuList.
• showMenu: Display the menu to the customer. The customer must be told how to select items.
• printCheck: Calculate and print the check. A 5% tax is added to the total.
Output should be formatted to two decimal places. The name of each item must be left-justified. You may assume a user selects only one item of a particular type.
Sample Output
Thank you for eating at Our Restaurant
Bacon and Egg $2.45
Muffin $0.99
Coffee $0.50
Tax $0.20
Amount Due $4.14

This is what I have so far. I didn't think it was too long to post it all.

#include <iostream>
using namespace std;
struct menuItemType
       char menuItem[21];
       double menuPrice;
const int numitems = 8;
int main ()
    int i = 0;
    menuItemType.menuList [listLength];
    while ( i < listLength)
          cout << i + 1 << " " << menuList [i] menuItem
                        << " " << menuList [i] menuPrice
                        << endl;
    system ("pause");
    return 0;

void showMenu ()

void getData ()
     fstream file;
     char ch;
     for (int i = 0; i < listLength; i ++)
         file.get(menuList [i].menuItem, 21);
         file >> menuList [i].menuPrice;

void printCheck ()


function getData()
1) You did not open the file. I suggest you use ifstream instead of fstream because I think its easier to use. ifstream file("MenuData.txt"); You didn't post the contents of the data file so I don't know how it should be read. But I'm sure its not like the loop you posted. Post a few lines of the file and we can give you more help with that.

Line 12: should be a space, not a period in that line.

oh sorry... this is the text file info... it's called MenuData.txt

Plain Egg
Bacon and Egg
French Toast
Fruit Basket

Read this before posting.. see if you can figure out what you did wrong, all by yourself :icon_wink:

I thought that assignment looked awfully familiar, then when I saw the menu it rang another bell. I commented on a thread with the exact same menu, then I typed "Bacon and Egg" into the search engine and a whole bunch of threads came up. To the OP, type that in, as well as a few other key words, and you'll find several threads from this exact same problem. You guys must have the same teacher.

commented: :) +3