Hi everybody,

can you help me to solve this problem ?!!
I need your help please ..

(1) Define a structure named menuItemSpecificationType that stores ingredients in a menu item (string [4]) and a brief description of the item (string).
(2) Define a structure named menuItemType with four components: num (int), name (string), description (menuItemSpecificationType), and price (double).
(3) Define a structure named selectedItemType with two components: num(int) and quantity (int).
(4) Write a program to help a restaurant automate its breakfast billing system. The program should do the following:
(a) Show the customer the different breakfast items offered by the restaurant.
(b) Show the customer a description of a specific item according to the customer request.
(c) Allow the customer to select more than one item from the menu. The customer may ask for multiple items of one type.
(d) Calculate and print the bill.

Use an array, menuList, of struct menuItemType and an array choiceList of selectedItemType. Your program must contain at least the following functions:

(a) Function getData: This function loads the data into the array menuList. The number of menu items in the file is known. The prototype of the function is:
void getData(ifstream& inFile, menuItemType mList[], int listSize);

(b) Function showMenu: This function shows the different items offered by the restaurant and tells the user how to select the items. The function allows the user to select an item to display its description. The prototype of the function is:
void showMenu(menuItemType mList[], int listSize);

(c) Function makeSelection: This function allows the user to select menu items and specify their quantities. The prototype of the function is:
void makeSelection (menuItemType mList[], int listSize,
selectedItemType sList[], int& sListLength);

(d) Function printCheck: This function calculates and prints the check. Note that the billing amount should include a 5% tax). Format your output with three decimal places. The name of each item in the output should be left-justified.
The prototype of the function is: void printCheck(menuItemType mList[], int listSize, selectedItemType sList[], int sListLength);

Thanx in advance .. :)

How about showing us what you have done so far ?

Thanx ~s.o.s~ for passing here ..

this is what i did ..
i did what i Know only ..
please tell me what i shall we do !!

#include<iostream>
#include<fstream>
#include<string>
using namespace std;
struct menuItemSpecificationType{
 string[4];
 string description;
};
struct menuItemType{
 int num;
 string name;
 menuItemSpecificationType descripion;
 double price;;
};
struct selectedItemType{
 int num;
 int quantity;
};
void getdata(ifstream& infile, menyItemType mList[], int listSize);
 
int main(){
 menuItem mList[10];
 selectType sList[10];
 ifstream infile;
 infile.open("Ex4Data.dat");
 getdata(infile,mList,4);
 showmenu(mlist,4);

and i define a file there was a list of menu

Plain Egg egg oil salt peper
fried egg with salt and peper
1.450
Mashroom and Egg
mashroom egg oil salt
fried egg with mashroom and salt and peper
2.450
Muffin
flour oil sugar egg
backed flour with egg and sugar in cups
0.990
French toast
toast egg oil salt
fried toast with eggs
1.990

i will try again also ..
to reach the solution

I know this solution bad and missing a lot of things .. :-|

Yeah, I guess you are missing on your basics pretty badly. I would really recommend you to start googling for terms like C++ structs, loops, conditions, functions, file operations etc...Try coming up with a code which is somewhere near the actual problem requirements and we would definately help you out.

I know.. C++ structs, loops, conditions, functions, file operations
but i can't write the solution ,,

can you just tell what to do please ..
and i will wrote the codes ,, :)

What's this line supposed to do?

string[4];

And btw you still need to code getdata , or if you have, you need to post it here...

What's this line supposed to do?

string[4];

And btw you still need to code getdata , or if you have, you need to post it here...

I mean that

string Item[4];

=====

Look at this ..

#include<iostream>
#include<fstream>
#include<string>
using namespace std;
struct menuItemSpecificationType{
 string Item[4];
 string description;
};
struct menuItemType{
 int num;
 string name;
 menuItemSpecificationType  descripion;
 double price;
};
struct selectedItemType{
 int num;
 int quantity;
};
 
void getData(ifstream&infile,menuItemType mlist[],int size);
int i=o;
while (infile){
 list[i].num=i+1;
 getline(infile,list[i].name,'\t')
  for(int j=0;j<4;j++)
   infile>>list[i].d.item[j];
  getline(infile,list[i].d.desc,'\t')
   infile>>price;
void showMenu(menuItemType mlist[],int listSize);
void makeSelection(menuItemType mlist[],int listSize,selectedItemType slist[],int& slistLength);
void printCheck(menuItemType mlist[],int listSize,selectedItemType slist[],int slistLength); 
int main(){
 menuItem mList[10];
 selectType sList[10];
 ifstream infile;
 infile.open("Ex4Data.dat");
 
 getdata(infile,mList,4);
 showmenu(mlist,4);

I know.. C++ structs, loops, conditions, functions, file operations

Looking at the code you posted it's hard to beleive that..
Unfortunately given the number of basic errors in code are too many.. As someone said it's better if you brush up the basics, re-write this piece of code, compile it and the post again.. it's simply too much to write for anyone if they have to correct everything in this code..

Forgot the reason why I started prev post..
See these links for some basics..

Forgot the reason why I started prev post..
See these links for some basics..

This basics to c language
i study c++ language

and i will try to solve the problem and i put it here
to show you i know the basics .. :)
I was only want some assistance ...

Thank you for all :)

Forgot the reason why I started prev post..
See these links for some basics..

try to put this function instead of the last one printcheck.
may be the reply is too late but it could be useful for others.
best regards

void printCheck(menuItemType printorder[]) 
{ 
//  const double taxRate = 0.10; 
    int x;
    double amtDue = 0;
    double tax = 0; 

    cout << endl;
    cout << endl;
    cout << endl;

    cout << "     ================================== " << endl; 
    cout << "               R E C E I P T !          " << endl; 
    cout << "     ================================== " << endl; 
    cout << "       WELCOME TO JOHNNY'S RESTAURANT   " << endl; 
    cout << "     ================================== " << endl; 
    cout << endl;

    for (x=0; x<2; x++) 
    { 

    cout.precision(2);
    cout << showpoint;
    tax = tax + ((printorder[x].menuPrice) * 0.10); 


            cout << printorder[x].menuItem << setw(16) << "$ " << printorder[x].menuPrice << endl; 

    }


    cout.precision(2);
    cout << showpoint;
    cout<<"     Tax                         $ " << tax << endl; 
    cout.precision(2);
    cout << showpoint;

//amount
    for (x=0; x<2; x++) 
    { 

    cout.precision(2);
    cout << showpoint;
    amtDue = amtDue +(printorder[x].menuPrice);


    }

    amtDue = amtDue + tax;
    cout.precision(3);
    cout << showpoint;

        cout<<"     Amount Due                  $ " << amtDue <<endl;


}

try to put this function instead of the last one printcheck.
may be the reply is too late but it could be useful for others.
best regards

Only about a year late..

"but it could be useful for others"

Don't resurrect old threads!

Inevitably, if you use the search feature you'll stumble upon an interesting thread that you think you can add to. Resist the temptation to post until you've looked at the post date for the most recent post in that thread. It's possible that the thread is years old and you have no business bumping it to the top of the list. A thread is considered old after two months.

Let dead threads lie, don't post in them!

http://www.daniweb.com/forums/thread78223.html

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.