So I have most of the code working but I can't seem to get it to send out
to the text page. So if there's something I'm missing with my outs please help.
Very beginner, so if there are other errors I made that help would be great too.
/******************************************************************************
File: Menu_Order.cpp CISC 175 Author: William Cogswell
This Program will run as a way to keep track of menu items purchased
throughout a day. The Prgram will keep track of how many of each item was
purchased as well as the total amount spent on each item as well as
the total income from all the items purchased. The user can only enter
numbers 1-5 with zero closing the program for the day and giving you totals.
The prgram runs as a do while loop continuing to take orders so long that
the user does not enter zero, which closes the program.
*******************************************************************************/
#include<iostream>
#include<cstdlib>
# include <fstream>
# include <iomanip>
# include <ctime>
usingnamespace std;
int main()
{
double Total_Price;
int Item,
count_bw = 0,
count_sb = 0,
count_is = 0,
count_sn = 0,
count_vs = 0;
string name;
cout<<"This Program will run as a way to keep track of menu items purchased\n";
cout<<"throughout a day. The Prgram will keep track of how many of each item was\n";
cout<<"purchased as well as the total amount spent on each item as well as\n";
cout<<"the total income from all the items purchased. The user can only enter\n";
cout<<"numbers 1-5 with zero closing the program for the day and giving you totals.\n";
cout<<"Please Enter Customer's Name:\n";
cin>>name;
cout<<"\n\nPlease Enter Order Numbers for Customer "<<name<<" :\n\n";
do
{
cin>>Item;
if (Item == 1)
{
cout<<"\nAdding one ""Buffalo Chicken"" to order for "<<name<<"\n\n";
(Total_Price = Total_Price + 6.95);
(count_bw = count_bw + 1);
}
elseif (Item == 2)
{
cout<<"\nAdding one ""Super Burger"" to order for "<<name<<"\n\n";
(Total_Price = Total_Price + 5.75);
(count_sb = count_sb + 1);
}
elseif (Item == 3)
{
cout<<"\nAdding one ""Italian Sandwich"" to order for "<<name<<"\n\n";
(Total_Price = Total_Price + 7.25);
(count_is = count_is + 1);
}
elseif (Item == 4)
{
cout<<"\nAdding one ""Shrimp Nuggets"" to order for "<<name<<"\n\n";
(Total_Price = Total_Price + 8.95);
(count_sn = count_sn + 1);
}
elseif (Item == 5)
{
cout<<"\nAdding one ""Veggie Supreme"" to order for "<<name<<"\n\n";
(Total_Price = Total_Price + 4.95);
(count_vs = count_vs + 1);
}
else
{
cout<<"\nYou have a number that does not have a menu item\n";
cout<<"assigned to it, please try again\n\n";
}
}
while (Item != 0);
cout<<"Your total Order was $"<<Total_Price<<setprecision(2)<<" for customer "<<name<<"\n\n";
cout<<"There were "<<count_bw<<" Orders of Buffalow Wings\n";
cout<<"There were "<<count_sb<<" Orders of Super Burgers\n";
cout<<"There were "<<count_is<<" Orders of Italian Sandwiches\n";
cout<<"There were "<<count_sn<<" Orders of Shrimp Nuggets\n";
cout<<"There were "<<count_vs<<" Orders of Veggie Supremes\n\n";
outs.open("Food.txt",ios::app);
outs<<fixed<<showpoint;
outs<<" Daily Summary For Customer "<<name<<"\n";
outs<<"==============="<<endl;
outs<<" Item Quantity Unit Price Amount of Sale"<<endl;
outs<<"---------------- ---------- ------------ ----------------"<<endl;
outs<<setw(16)<<left<<"Buffalo Wings"<<right<<setw(15)<<setprecision(0)<<count_bw<<
right<<setw(15)<<"$6.95"<<right<<setw(18)<<"$"<<setprecision(2)
<<(6.95*count_bw)<<endl;
outs<<setw(16)<<left<<"Super Burger"<<right<<setw(15)<<setprecision(0)<<count_sb<<
right<<setw(15)<<"$5.75"<<right<<setw(18)<<"$"<<setprecision(2)
<<(5.75*count_sb)<<endl;
outs<<setw(16)<<left<<"Italian Sandwich"<<right<<setw(15)<<setprecision(0)<<count_is<<
right<<setw(15)<<"$7.25"<<right<<setw(18)<<"$"<<setprecision(2)
<<(7.25*count_is)<<endl;
outs<<setw(16)<<left<<"Shrimp Nuggets"<<right<<setw(15)<<setprecision(0)<<count_sn<<
right<<setw(15)<<"$8.95"<<right<<setw(18)<<"$"<<setprecision(2)
<<(8.95*count_sn)<<endl;
outs<<setw(16)<<left<<"Veggie Supreme"<<right<<setw(15)<<setprecision(0)<<count_vs<<
right<<setw(15)<<"$4.95"<<right<<setw(18)<<"$"<<setprecision(2)
<<(4.95*count_vs)<<endl;
outs.close();
system("PAUSE");
return 0;
}