[Dev-C++] RE : another Run Problem - to Charles
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <ad...@Ho...> - 2001-12-04 17:37:27
|
Well, I suppose my message was not precise enough.
The problem I encountered was that the Dos windows closed without
waiting me to hit the return key. It did with the 'system("pause")'
instruction.
I just tested the solution that Ricardo Lopez Ruiz sent: replace
fflush(stdout) with fflush(sdtin) that finally seems to work fine.
So I suppose that I make a mistake somewhere else in the program. Please
let me know if you find it. Here is the full source:
#include <stdio.h>
main()
{
int i,n,som;
i =3D 0;
n =3D 0;
som =3D 0;
printf("\n=3D=3D=3D=3D Somme des n premiers multiples de 3 =
=3D=3D=3D=3D\n\nEntrez la
valeur de n : "); scanf("%d",&n); n=3Dn*3;
while(n>i)
{
i+=3D3;
som=3Dsom+i;
}
printf("La somme est : %d\n",som);
printf("Taper ENTREE pour continuer...");
fflush(stdout);
getchar();
}
--
Andr=E9 Duc-Taffe ad...@ho...
:::::::::::::::::::::::::::::::::::::::::::::::::
http://www.lescastro.fr.st
http://www.exempligratia.net
|