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
| #include <stdio.h>
#include <stdlib.h>
#if defined (WIN32)
# define CLEAR "CLS"
#elif defined (__linux)
# define CLEAR "clear"
#else
# error "Not defined for this plateform"
#endif
void afficher(double montant);
void pause(char const *message);
int main(void)
{
double montant = 22.5; /* CHF */
afficher(montant);
pause("Appuyez sur ENTER pour continuer...");
system(CLEAR);
montant = montant * 2;
afficher(montant);
return 0;
}
void afficher(double montant)
{
printf("------------------\n");
printf("Montant: %.2f\n", montant);
printf("------------------\n");
}
void pause(char const *message)
{
int c;
if (message != NULL)
{
printf("%s ", message);
fflush(stdout);
}
c = getchar();
if (c != '\n' && c != EOF)
{
while ((c = getchar()) != '\n' && c != EOF)
{
}
}
} |