Home › Forums › C Programming › hi…. › Reply To: hi….
April 27, 2009 at 11:37 am
#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…..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | #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(); } |