void menu2()
{
ofstream write;
write.open("order.txt");
if(!write)
{
cout<<"file can not open"<<endl;
exit (-1);
}
a:
cout<<"\n\n\tENTER YOUR ORDER (one order at a time): ";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\n\n\tHOW MANY order YOU WANT :";
cin>>order;
total=total+(480*order);
write<<"YOU ORDER Veggie Supreme : 480";
write<<" \n";
write<<"NUMBER OF order IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Veggie Supreme "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 2:
cout<<"\n\n\tHOW MANY order YOU WANT :";
cin>>order;
total=total+(440*order);
write<<"YOU ORDER Exotica : 440";
write<<" \n";
write<<"NUMBER OF order IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Exotica "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 3:
cout<<"\n\n\tHOW MANY CHICKEN SIZZLER YOU WANT :";
cin>>order;
total=total+(580*order);
write<<"YOU ORDER Chicken Sizzler : 580";
write<<" \n";
write<<"NUMBER OF Chicken Sizzler IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Chicken Sizzler "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 4:
cout<<"\n\n\tHOW MANY CHRISPY CHICKEN YOU WANT :";
cin>>order;
total=total+(520*order);
write<<"YOU ORDER Chrispy Chicken : 520\n";
write<<"NUMBER OF Chrispy Chicken IS : "<<order;
cout<<"\n\n\n\tYOU ORDER Chrispy Chicken "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 5:
cout<<"\n\n\tHOW MANY SPAGHETTI YOU WANT:";
cin>>order;
total=total+(350*order);
write<<"YOU ORDER Spaghetti : 350";
write<<"NUMBER OF Spaghetti IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Spaghetti "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 6:
cout<<"\n\n\tHOW MANY order YOU WANT:";
cin>>order;
total=total+(400*order);
write<<"YOU ORDER Country Feast : 400";
write<<"\n ";
write<<"NUMBER OF order IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Country Feast "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 7:
cout<<"\n\n\tHOW MANY TETRAZZINI YOU WANT:";
cin>>order;
total=total+(420*order);
write<<"YOU ORDER Tetrazzini : 420";
write<<"\n ";
write<<"NUMBER OF Tetrazzini IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Tetrazzini "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 8:
cout<<"\n\n\tHOW MANY order YOU WANT :";
cin>>order;
total=total+(540*order);
write<<"YOU ORDER Double Cheese : 540";
write<<" \n";
write<<"NUMBER OF order IS : "<<order;
write<<"\n";
cout<<"\n\n\n\tYOU ORDER Double Cheese "<<endl<<"\tYOUR ORDER SUCCESSFULLY SAVED "<<endl;
break;
case 9:
cout<<"Proceed to checkout: ";
checkout();
break;
case 10:
cout<<"\n\t\t\t\t\t Brought To You By code-projects.org";
exit(0);
break;
default:
cout<<"\n\n\t\t\t\t\t\t\tYOU ENTER WRONG ORDER KEY !!!!! "<<endl;
break;
}
cout<<"\n\tDO YOU WANT ANOTHER ORDER (yes=1/no=0) :";
cin>>yes;
if(yes==1)
{
goto a;
}
else
write.close();
checkout();
}
int getOrder()
{
constint orderMax = 10;
int order = orderMax + 1;
while ( order > orderMax )
{
cout << "How many would you like? ";
cin >> order;
if ( order > orderMax ) cout << "That's greedy; you'll get fat.\n\n";
}
return order;
}
It works but I also want to Include the quantity of overall order like for example I ordered 2 pizza and 2 burger then the overall order will be count as 4.