Hello,
I need help with this code please.
I want to make this do:
1. when i press Q it will ...
I need help with this code please.
I want to make this do:
1. when i press Q it will ...
Code:
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main()
{
char choice='Y';
int order = 1;
float num1=0, num2=0, num3=0, num4=0, num5=0, total=0;
int num_customers;
int sentinel=0;
const double Price1= 10.35, Price2= 15.35,Price3= 18.25, Price4= 15.55, Price5= 12.55;
double Sale1=0, Sale2=0, Sale3=0, Sale4=0, Sale5=0;
cout <<" ¦¦¦¦¦¦¦¦¦¦¦¦¦¦ Hero list ¦¦¦¦¦¦¦¦¦¦¦¦¦\n\n"
<<" ¦(1) Spider Man $10.35\n"
<<" ¦(2) Iron Man $15.35\n"
<<" ¦(3) Captain America $18.25\n"
<<" ¦(4) Hulk $15.55\n"
<<" ¦(5) Thor $12.55\n"
<<" ¦(6) Total \n";
while (order != sentinel)
{
cout<<"Choose what Marvel hero you would like to order:\n";
cin>>order;
switch(order)
{
case 1:
cout<<"How many would you like to order:\n";
cin>>num1;
Sale1 = Price1 * num1;
cout<<"You have ordered:\n\n";
cout<<left<<setw(15)<<"ITEM"<<right<<setw(10)<<"QUANTITY"<<right<<setw(15)<<"UNIT PRICE"<<right<<setw(20)<<"AMOUNT OF SALE\n";
cout<<"Spider Man toy:"<<setw(6)<<left<< num1 <<setw(16)<<right<< Price1 <<setw(20) <<right<< Sale1<<endl;
break;
case 2:
cout<<"How Iron Man toy would you like to order:\n";
cin>>num2;
Sale2= Price2 * num2;
cout<<"You have ordered:\n\n";
cout<<left<<setw(15)<<"ITEM"<<right<<setw(10)<<"QUANTITY"<<right<<setw(15)<<"UNIT PRICE"<<right<<setw(20)<<"AMOUNT OF SALE\n";
cout<<"Iron Man toy:"<<setw(6)<<left<< num2 <<setw(16)<<right<< Price2 <<setw(20) <<right<<Sale2<<endl<<endl;
break;
case 3:
cout<<"How many Captain America toy would you like to order:\n";
cin>>num3;
Sale3= Price3 * num3;
cout<<"You have ordered:\n\n";
cout<<left<<setw(15)<<"ITEM"<<right<<setw(10)<<"QUANTITY"<<right<<setw(15)<<"UNIT PRICE"<<right<<setw(20)<<"AMOUNT OF SALE\n";
cout<<"Captain America toy:"<<setw(6)<<left<< num3 <<setw(16)<<right<< Price3 <<setw(20) <<right<< Sale3<<endl<<endl;
break;
case 4:
cout<<"How many Hulk toy would you like to order:\n";
cin>>num4;
Sale4= Price4 * num4;
cout<<"You have ordered:\n\n";
cout<<left<<setw(15)<<"ITEM"<<right<<setw(10)<<"QUANTITY"<<right<<setw(15)<<"UNIT PRICE"<<right<<setw(20)<<"AMOUNT OF SALE\n";
cout<<"Hulk toy:"<<setw(6)<<left<< num4 <<setw(16)<<right<<Price4 <<setw(20) <<right<< Sale4<<endl<<endl;
break;
case 5:
cout<<"How many Thor toy would you like to order:\n";
cin>>num5;
Sale5= Price5 * num5;
cout<<"You have ordered:\n\n";
cout<<left<<setw(15)<<"ITEM"<<right<<setw(10)<<"QUANTITY"<<right<<setw(15)<<"UNIT PRICE"<<right<<setw(20)<<"AMOUNT OF SALE\n";
cout<<"Thor toy:"<<setw(6)<<left<< num5 <<setw(16)<<right<<Price5 <<setw(20) <<right<<Sale5<<endl<<endl;
break;
case 6:
total = Sale1 +Sale2 + Sale3 + Sale4 +Sale5;
cout<<"your total order is:"<< total << endl << endl;
break;
default: cout<<"Please use the list as a reference for orders made\n";
}
}
system("PAUSE");
return 0;
}
Comment