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
| pur31-2-82-225-219-67:~ # vi toto.c
7:~ # gcc toto.c -o titi
toto.c: In function Arrondit:
toto.c:11: error: called object floor is not a function
toto.c:15: error: called object ceil is not a function
7:~ # vi toto.c
7:~ # gcc toto.c -o titi
7:~ # ./titi
donne ton nbre
10.2
PT de x = 10.700000
7:~ # cat toto.c && rm titi toto.c
#include<stdio.h>
#include <stdlib.h>
#include<math.h>
double Arrondit( double x)
{
if (0<=x)
{
return (x+0.5);
}
else
{
return (x-0.5);
}
}
main() {
double Arrondit( double x);
double nbre ;
printf("donne ton nbre\n");
scanf("%lf",&nbre);
printf("PT de x = %f\n", Arrondit( nbre) );
}
7:~ # |
Partager