|
From: <LO5...@ao...> - 2001-05-20 23:00:42
|
void main()=20
{=20
char choice;=20
int quantity;=20
int quit;=20
int cost;=20
int cost1;=20
int cost2;=20
int cost3;=20
int cost4;=20
int cost5;=20
int cost6;=20
int cost7;=20
int cost8;=20
int cost9;=20
int count =3D0 ;=20
int fbw=3D 61;=20
int fbb=3D 68;=20
int dp=3D 48;=20
int cc=3D358;=20
int crp=3D 98;=20
int cmp=3D159;=20
int pies=3D53;=20
int t1=3D92;=20
int t2=3D127;=20
int num;=20
cout << SKIP << "* * ******** The Bakery ************ * *" ;=20
cout << endl;=20
cout << endl;=20
cout << SKIP <<" Item code Item Price " ;=20
cout << SKIP;=20
cout << endl;=20
cout << endl;=20
cout << SKIP <<" a Fresh Bread White 61p "=20=
;=20
cout << endl;=20
cout << SKIP <<" b Fresh Bread brown 68p " ;=20
cout << endl;=20
cout << SKIP <<" c danish pastries 48p " ;=20
cout << endl;=20
cout << SKIP <<" d celabration cake 358p "=20=
;=20
cout << endl;=20
cout << SKIP <<" e cookies regular pack 98p "=20=
;=20
cout << endl;=20
cout << SKIP <<" f cookies maxi pack 159p "=20=
;=20
cout << endl;=20
cout << SKIP <<" g pies 53p " ;=20
cout << endl;=20
cout << SKIP <<" h sandwiches type 1 92p " ;=20
cout << endl;=20
cout << SKIP <<" i sandwiches type 2 127p "=20=
;=20
cout << endl;=20
cout << endl;=20
cout << SKIP <<"******************************************************"=20=
;=20
cout << endl;=20
count =3D 0 ;=20
while (quit !=3D SENNTINEL)=20
{=20
cout << "please select an item" <<endl;=20
cin >> choice;=20
cout << "please select quantity press"<<endl;=20
cin >> num;=20
count=3D count + 1;=20
cout<< count;=20
if(choice=3D 'a')=20
{=20
cost1=3D fbw * num;=20
}=20
if(choice=3D 'b')=20
{=20
cost2=3D fbb * num;=20
}=20
if(choice=3D'c')=20
{=20
cost3=3D dp * num;=20
}=20
if(choice=3D'd')=20
{=20
cost4=3D cc * num;=20
}=20
if(choice=3D'e')=20
{=20
cost5=3D crp * num;=20
}=20
if(choice=3D'f')=20
{=20
cost6=3D cmp * num;=20
}=20
if(choice=3D'g')=20
{=20
cost7=3D pies* num;=20
}=20
if(choice=3D'h')=20
{=20
cost8=3D t1 * num;=20
}=20
else if(choice=3D'i')=20
{=20
cost8=3D t2 * num;=20
}=20
cout << endl;=20
cout << "press -999 to quit or 111 to continue"<<endl;=20
cin >> quit;=20
}=20
cout << SKIP << "* * ******** The Bakery ************ * *" ;=20
cout << endl;=20
cout << endl;=20
cout << SKIP <<" Item code Item Price Quantity =20
Price2 " ;=20
cout << SKIP <<"=20
";=20
cout << endl;=20
cout << endl;=20
cout << SKIP <<" a Fresh Bread White 61p" <<" "<< =20
num <<" "<<cost1;=20
cout << endl;=20
cout << SKIP <<" b Fresh Bread brown 68p" <<" "<< =20
num <<" "<<cost2;=20
cout << endl;=20
cout << SKIP <<" c danish pastries 48p" <<" "<< =20
num <<" "<<cost3;=20
cout << endl;=20
cout << SKIP <<" d celabration cake 358p" <<" "<< =20
num <<" "<<cost4;=20
cout << endl;=20
cout << SKIP <<" e cookies regular pack 98p" <<" "<< =20
num <<" "<<cost5;=20
cout << endl;=20
cout << SKIP <<" f cookies maxi pack 159p" <<" "<< =20
num <<" "<<cost6;=20
cout << endl;=20
cout << SKIP <<" g pies 53p" <<" "<< =20
num <<" "<<cost7;=20
cout << endl;=20
cout << SKIP <<" h sandwiches type 1 92p" <<" "<< =20
num <<" "<<cost8;=20
cout << endl;=20
cout << SKIP <<" i sandwiches type 2 127p" <<" "<< =20
num <<" "<<cost9;=20
cout << endl;=20
cout << endl;=20
cout << SKIP <<"******************************************************"=20=
;=20
cout << endl;=20
system("PAUSE");=20
return 0;=20
}=20
hello programmers i was wondering if anyone could help me with a problem , i=
=20
am trying to calculate num but i can only calculate the last num entered by=20
the user i want to calculate all num (numbers) that the user types in ie i=20
want num to be stored each time a different value for num is entered so that=
=20
i can calculate different quantities of items=20
eg, 10(num) * =A33.50=20
2(num) *61p=20
15(num) 89p=20
each time num is entered i only receive calculations for the last num entere=
d=20
15 in this example, but i need all nums to be calculated. The user can only=20
type in a code for an item eg a=3Dfresh brown bread followed by a quantity=20
(represented by num) this process is repeated until the user is happy with=20
there selection from the menu. I need to print out a menu indicating item ,=20
quantity , then cost which is item * quantity but i seem to only be able to=20
calculate the last num the user enters.=20
thanx for your precious time and patience in advance=20
from lostboyz.=20
|