Re: [Dev-C++] How to add the total.......
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Verne H. B. <ve...@sy...> - 2005-04-15 02:18:53
|
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.
Can someone else help the gentleman.
Verne
----- Original Message -----=20
From: LETCHUMANAN SAMINADAN=20
To: Dev-Cpp=20
Sent: Thursday, April 14, 2005 9:48 PM
Subject: [Dev-C++] How to add the total.......
Dear all,
I'm having a problem in in adding the total amount, my program as =
below...
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
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...
Thanks to all,
Letchu...
Yahoo! Mobile
- Download the latest ringtones, games, and more!
|