RE: [Dev-C++] How to add the total.......
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Reid T. <Rei...@at...> - 2005-04-15 12:43:02
|
nope..
=20
int a =3D 6.25, b =3D 12.50 , c =3D 13.80;=20
=20
will result in an integer being returned.
reid=20
-----Original Message-----
From: Verne H. Bohlender [mailto:ve...@sy...]=20
Sent: Thursday, April 14, 2005 10:19 PM
To: Dev C++; LETCHUMANAN SAMINADAN
Subject: Re: [Dev-C++] How to add the total.......
This must be some type of C language but with C++ you'd simply do this
if=20
int a =3D 6.25, b =3D 12.50 , c =3D 13.80;
cout << a + b + c;
and you'd see the answer as the total of the three numbers.
=20
Can someone else help the gentleman.
Verne
----- Original Message -----=20
From: LETCHUMANAN SAMINADAN <mailto:arl...@ya...> =20
To: Dev-Cpp <mailto:dev...@li...> =20
Sent: Thursday, April 14, 2005 9:48 PM
Subject: [Dev-C++] How to add the total.......
Dear all,
=20
I'm having a problem in in adding the total amount, my program as
below...
=20
if((col=3Dfopen("total utility.doc","r"))=3D=3DNULL)
printf("Cannot open file!");
else
{ =20
while(!feof(col))
{
fscanf(col,"%f\n",&data.utl);
=20
printf("%.2f\n",data.utl); =20
=20
} =20
} =20
fflush(stdin); =20
printf("Press ENTER to continue....");
getchar();
fflush(stdin);
=20
fclose(col);
The output:- 6.25
12.50
13.80
=20
I want the total to be displayed as, 32.55. There is a way to get it,
can someone please help me on this program...
=20
Thanks to all,
Letchu...
=20
=20
<http://sg.yimg.com/i/sg/icons/16/sms2.gif> Yahoo! Mobile
<http://sg.rd.yahoo.com/mail/tagline/?http://sg.mobile.yahoo.com/>=20
- Download the latest ringtones, games, and more!
|