Home Forums C Programming hi…. Reply To: hi….

#3556
MerissaQxm
Participant

i know dis is da wrong way 2 b doin da program….but i’m jus a beginner….so dis is da best i cud think of….and i seriously need all da help dat i can get….plsssssssssssssss…..

#include <iostream.h>
#include <conio.h>
float b=1000;
void main()
{
clrscr();
float x,b,c,amount1,amount2,amount3,p,s,j;
float d,a,o,q,r,t,u,v,w,g,h;
int  m;
char choice;
char l,Y,y,N,n;
cout<<"nwelcome 2 my grocery store!!!!";
cout<<"nwould u like 2 see the items available for purchase(y/n)?";
cin>>choice;
if(choice=='Y'||choice=='y')
{
cout<<"the items available are:";
cout<<"nno."<<'t'<<"item         "<<'t'<<"quantity(b)(in grams)"<<'t'<<"m.r.p(c)";
cout<<"n---"<<'t'<<"----         "<<'t'<<"
<hr class="bbcode_rule" />
"<<'t'<<"
<hr class="bbcode_rule" />
";
cout<<"n1. "<<'t'<<"urad dal     "<<'t'<<"1000g                "<<'t'<<"Rs.50.25";
cout<<"n2. "<<'t'<<"tur  dal     "<<'t'<<"1000g                "<<'t'<<"Rs.60.75";
cout<<"n3. "<<'t'<<"tea powder   "<<'t'<<"1000g                "<<'t'<<"Rs.200.0";
cout<<"nwould you like 2 purchase any item?(y/n)";
cin>>choice;
if(choice=='Y'||choice=='y')
{
cout<<"nyou can purchase only two items( kindly press 'n' after purchasing two items";
m:
cout<<"nenter the no:of the item chosen by u";
cin>>m;
if(m==1)
{
cout<<"nenter the amount of the item  u want to purchase";
cin>>x;
amount1=(x*50.25)/1000.00;
cout<<"nthe amount to be paid is:"<<amount1<<"n";
}
else if(m==2)
{
cout<<"nenter the amount of item ";
cin>>x;
amount2=(x*60.75)/1000.00;
cout<<"nthe amount 2 b paid is:"<<amount2<<"n";
}
else if(m==3)
{
cout<<"nenter the amount of item";
cin>>x;
amount3=(x*200.00)/1000.00;
cout<<"nthe amount 2 be paid is:"<<amount3<<"n";
}
cout<<"ndo u want 2 buy another item?";
cin>>l;
if(l=='y'||l=='Y')
{
goto m;
}
else{
cout<<"nplease wait.... ur bill is being calculated....";
}
cout<<"nenter da no: of the  items u've bought in an order(enter 0 for the second item if u've bought only one item:";
cin>>s>>j;
if(s==1&&j==0)
{
o=amount1;
cout<<"nthe total bill is:"<<o;
}
else if(s==1&&j==1)
{
p=amount1+amount1;
cout<<"nthe total bill is:"<<p;
}
else if(s==1&&j==2)
{
q=amount1+amount2;
cout<<"nthe total bill is:"<<q;
}
else if(s==1&&j==3)
{
r=amount1+amount3;
cout<<"nthe total bill is:"<<r;
}
else if(s==2&&j==0)
{
a=amount2;
cout<<"nthe total bill is:"<<a;
}
else if(s==2&&j==1)
{
t=amount2+amount1;
cout<<"nthe total bill is:"<<t;
}
else if(s==2&&j==2)
{
u=amount2+amount2;
cout<<"nthe total bill is:"<<u;
}
else if(s==2&&j==3)
{
v=amount2+amount3;
cout<<"nthe total bill is:"<<v;
}
else if(s==3&&j==0)
{
w=amount3;
cout<<"nthe total bill is:"<<w;
}
else if(s==3&&j==1)
{
g=amount3+amount1;
cout<<"nthe total bill is:"<<g;
}
else if(s==3&&j==2)
{
h=amount3+amount2;
cout<<"nthe total bill is:"<<h;
}
else if(s==3&&j==3)
{
d=amount3+amount3;
cout<<"nthe total bill is:"<<d;
}

cout<<"nplease pay the requested amount";
cout<<"nthank you.please visit again";
}
else if(choice=='N'||choice=='n')
{
cout<<"nthanks for visiting my store !!!";
}
}
else if(choice=='N'||choice=='n')
{
cout<<"nthank you.kindly try purchasing the next time u visit the store!!!!!";
}
getch();
}