Mathc initiation/Fichiers h : x 18d02b
Installer et compiler ces fichiers dans votre répertoire de travail.
![]() |
d02b.c |
---|
/* ---------------------------------- */
/* save as d02b.c */
/* ---------------------------------- */
#include "x_hfile.h"
/* ---------------------------------- */
# define DEGREE 2
# define COEFF DEGREE + 1
/* ---------------------------------- */
int main(void)
{
int n = 3;
double *Px;
double *Pt;
double *Pa;
double A[3] = {-3,-20,4};
Px = I_p(n); /* Px = P(x) */
Pt = I_p(n); /* Pt = P temporaire */
Pa = I_p(n); /* Pa = P(a) */
clrscrn();
c_a_P(A,Px);
printf(" If P(x) is : \n\n");
p_P(Px);
printf(" If you use p_horner(); without compute_horner(); \n\n");
p_horner(Px,Pt,Pa);
stop();
free(Px);
free(Pt);
free(Pa);
return 0;
}
Dans cet exemple on voit une utilisation de la fonction p_horner();
Exemple de sortie écran :
If P(x) is :
-3.00*x**2 -20.00*x +4.00
If you use p_horner(); without compute_horner();
-3.00 -20.00 +4.00
+0.00 +0.00 +0.00
------------------------------
+0.00 +0.00 +0.00
Press return to continue.