C++ Program of Project Using Structure, Coffee Bar Project
#include<iostream>
#include<string.h>
#include<math.h>
#include<iomanip>
#include<conio.h>
#include<stdlib.h>
struct taka{
int quan;
int amount;
int rate;
char name[20];
}t[10];
using namespace std;
void line()
{
for(int j=0;j<70;j++)
{
cout<<"=";
}
cout<<endl;
}
int main()
{
int i=0,order=0,flag=0,sum=0,a=1;
system("COLOR A5");
char ch;
start:
line();
cout<<"|Welcome to Uncle's Cofee bar|\n";
line();
cout<<"What Would You Like To Order Today!?\n";
line();
cout<<"All Items are in standard currency Rupees\n";
line();
cout<<"01.Tea 15\n";
cout<<"02.Cofee 15\n";
cout<<"03.Hot Milk 25\n";
cout<<"04.Sandwhich 40\n";
cout<<"05.Nachos 25\n";
cout<<"What Would You Like To Order :";
cin>>order;
do{
i++;
switch(order)
{
case 1:
cout<<"How many Tea :";
cin>>t[i].quan;
t[i].rate=15;
t[i].amount=t[i].quan*t[i].rate;
flag++;
strcpy(t[i].name,"taka tak Chai");
break;
case 2:
cout<<"How Many cofee :";
cin>>t[i].quan;
t[i].rate=15;
t[i].amount=t[i].quan*t[i].rate;
flag++;
strcpy(t[i].name,"Cofee");
break;
case 3:
cout<<"How Many Hot Milk :";
cin>>t[i].quan;
t[i].rate=25;
t[i].amount=t[i].quan*t[i].rate;
flag++;
strcpy(t[i].name,"Milk");
break;
case 4:
cout<<"How Many Sandwhich :";
cin>>t[i].quan;
t[i].rate=40;
t[i].amount=t[i].quan*t[i].rate;
flag++;
strcpy(t[i].name,"Sandwhich");
break;
case 5:
cout<<"How Many Nachos :";
cin>>t[i].quan;
t[i].rate=25;
t[i].amount=t[i].quan*t[i].rate;
flag++;
strcpy(t[i].name,"Nachos");
break;
}
cout<<"Would Like To Order Something else also?Y/N :";
cin>>ch;
if(ch=='Y'||ch=='y')
{
system("cls");
goto start;
}
else if(ch!='Y'||ch!='y')
{
ch=0;
}
}while(ch!=0);
system("cls");
line();
cout<<"\t\tBill Invoice\n";
line();
cout<<std::left<<setw(5)<<"No."<<setw(25)<<"Name"<<setw(9)<<"Qty"<<setw(9)<<"Rate"<<setw(9)<<"Amount"<<endl;
line();
i=0;
do
{
i++;
sum=sum+t[i].amount;
cout<<std::left<<setw(5)<<a++<<setw(25)<<t[i].name<<setw(9)<<t[i].quan<<setw(9)<<t[i].rate<<setw(9)<<t[i].amount<<endl;
}while(i!=flag);
line();
cout<<"Your Total Bill is "<<sum<<endl;
line();
cout<<"\nPress Any Key To Continue...";
cin.ignore();
}
Comments
Post a Comment