#include <iostream.h>
#include <iomanip.h>
int main ()
{
int inch;
int extop;
int costtop;
int numtop;
double subtot;
double tot;
int chex;
double chezcost;
int piztop;
int price;
int top;
cout<< "6 inch personal $3.15 + .35 per topping\n"<< endl
<< "10 inch small $5.70 + .55 per topping\n"<< endl
<< "14 inch medium $7.45 + .70 per topping\n"<< endl
<< "16 inch large $9.15 + .85 per topping\n"<< endl
<< "18 inch exlarge $11.15+ $1.40 per topping\n\n"<< endl;
cout << "Enter size 6, 10, 14 etc..\n" << endl;
cin>> inch;
cout << " Extra toppings 1 = Yes -- 2 = No \n"<<endl;
cin>> extop;
cout <<"Extra Cheese 1 = Yes -- 2 = No"<<endl;
cin>> chex;
switch (inch)
{
case 6: price = 3.15;
break;
case 10: price = 5.70;
break;
case 14: price = 7.45;
break;
case 16: price = 9.15;
break;
case 18: price = 11.15;
break;
case "\n":
}
cout << "inch " << inch<<endl;
cout <<" price "<< setprecision(2)<< price <<endl;
if (extop !=2)
{
cout << "How many toppings"<< endl;
cin>> numtop;
switch (inch)
{
case 6:top =.35;
break;
case 10:top =.55;
break;
case 14:top =.70;
break;
case 16:top =.85;
break;
case 18:top = 1.40;
break;
}
cout <<" top "<< setprecision(2) <<top <<endl;//price of topping per size
costtop = (numtop * top);
cout<< "costtop" << setprecision(2)<<costtop<< endl;//cost of topping(s)
piztop= costtop + price;
cout<< "piztop"<< setprecision(2)<<piztop<< endl;//pizza and toppings cost
if (chex = 1)
{
if (inch = 6 || 10)
{
chezcost = 1.10; //excheese per inch
}
else
{
chezcost = 2.00;
}
}
cout << "chezcost\n\n"<< setprecision(2)<<chezcost <<endl;// cost of excheese
subtot = piztop + chezcost;
cout<< "Subtotal"<< setprecision(2)<<subtot<<endl;
cout<< "\n";
tot = (subtot*.675)+subtot;
cout<< "Total"<< setprecision(2)<<tot<<"\n\n";
return 0;
}
First problem, price is being output as a neg number