11-10-2011, 06:08 PM
#include<iostream.h>
#include<conio.h>
using namespace std;
int main()
{
int p=0; //initialized price
int tax=0; //initialized tax
cout << "*** Virtual Resturant ***"<<endl<<endl;
yes:
cout << "Enter The Price Of Meal: ";
cin >> p;
if(p>0 && p<=1000)
{
tax = 0;
}
else if(p>1000 && p<=2000)
{
tax = (p * 1)/100;
}
else if(p>2000)
{
tax = (p * 2)/100;
}
cout << endl << endl;
cout << "Price of Meal: "<< p << endl;
cout << "Sales Tax: "<< tax << endl;
cout << "---------------------------" << endl;
int total; //initialized total amount
total = p + tax;
cout << "Total Amount: "<< total << endl<<endl;
if(total < 1000)
cout << "This customer should be serverd with Candies"<<endl;
else if(total >= 1000 && total < 2000)
cout << "This customer should be serverd with Sweet Bread"<<endl;
else if(total >= 2000 && total < 3000)
cout << "This customer should be serverd with Pudding"<<endl;
else if(total >= 3000 && total < 4000)
cout << "This customer should be serverd with Cake"<<endl;
else if(total >= 4000)
cout << "This customer should be serverd with Trifle"<<endl;
cout << endl << endl;
char choice; //initizlized choice
cout << "Do you want to process another customer? "<<endl;
cout << "Enter 'Y' for Yes or 'N' to Exit: ";
cin >> choice;
cout << endl;
switch(choice)
{
case 'Y':
goto yes;
case 'y':
goto yes;
case 'n':
goto no;
case 'N':
goto no;
default:
goto no;
}
no:
cout << endl;
system("pause");
}
#include<conio.h>
using namespace std;
int main()
{
int p=0; //initialized price
int tax=0; //initialized tax
cout << "*** Virtual Resturant ***"<<endl<<endl;
yes:
cout << "Enter The Price Of Meal: ";
cin >> p;
if(p>0 && p<=1000)
{
tax = 0;
}
else if(p>1000 && p<=2000)
{
tax = (p * 1)/100;
}
else if(p>2000)
{
tax = (p * 2)/100;
}
cout << endl << endl;
cout << "Price of Meal: "<< p << endl;
cout << "Sales Tax: "<< tax << endl;
cout << "---------------------------" << endl;
int total; //initialized total amount
total = p + tax;
cout << "Total Amount: "<< total << endl<<endl;
if(total < 1000)
cout << "This customer should be serverd with Candies"<<endl;
else if(total >= 1000 && total < 2000)
cout << "This customer should be serverd with Sweet Bread"<<endl;
else if(total >= 2000 && total < 3000)
cout << "This customer should be serverd with Pudding"<<endl;
else if(total >= 3000 && total < 4000)
cout << "This customer should be serverd with Cake"<<endl;
else if(total >= 4000)
cout << "This customer should be serverd with Trifle"<<endl;
cout << endl << endl;
char choice; //initizlized choice
cout << "Do you want to process another customer? "<<endl;
cout << "Enter 'Y' for Yes or 'N' to Exit: ";
cin >> choice;
cout << endl;
switch(choice)
{
case 'Y':
goto yes;
case 'y':
goto yes;
case 'n':
goto no;
case 'N':
goto no;
default:
goto no;
}
no:
cout << endl;
system("pause");
}
