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
| #include <stdio.h>
void coeff(float *b,float *dir);
void intersection(float *a1,float *a2, float *b1, float *b2,float *x,float *y);
void main()
{
float a1,a2,b1,b2,x,y;
coeff(&b1,&a1);
coeff(&b2,&a2);
intersection(&a1,&a2,&b1,&b2,&x,&y);
printf ("Point d'intersection X = %f et Y = %f",&x,&y);
}
void coeff(float *b,float *dir)
{
printf("Tapez le coefficient directeur de la droite :");
scanf("%f",&dir);
printf("Tapez l'ordonnee a l'origine de la droite :");
scanf("%f",&b);
}
void intersection(float *a1,float *a2, float *b1, float *b2,float *x,float *y)
{
*y = (*b2-*b1)/(*a1-*a2);
*x = ((*y)-*b1)/(*a1);
} |
Partager