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
| int main (void)
{
system("title Recherche du point");
system("MODE CON lines=55 cols=120");
float pas=0.1;
printf("Veuillez entrer le pas :");
scanf("%f",&pas);
int max_i=(273/pas+1);
int max_j=(60/pas+1);
int i=1,j=0,k=0;
float x,y,r;
float dAP, dBP, dCP;
float precision=0.00001;
FILE *f=("resultat.txt","w");
for (i=1;i<max_i;i++)
{
for (j=0;j<max_j;j++)
{
x=i*pas*cos(60);
r=x/cos(j*pas);
y=r*sin(j*pas);
dAP=sqrt(x*x+y*y);
dBP=sqrt((x-273)*(x-273)+y*y);
dCP=sqrt((x-136,5)*(x-136,5)+(y-273*sin(60))*(y-273*sin(60)));
for (k=1;k<=237;k++)
{
if ( ( ((k-precision)<=dAP)&&( (k+precision)>=dAP) )
&&( ((k-precision)<=dBP)&&( (k+precision)>=dBP) )
&&( ((k-precision)<=dCP)&&( (k+precision)>=dCP) ) )
{
printf("dAP=%f\n",dAP);
printf("dAP=%f\n",dBP);
printf("dAP=%f\n",dCP);
fprintf(f,"r=%f, x=%f, y=%f, dAP=%f, dBP=%f, dCP=%f FAILURE\n",r,x,y,dAP,dBP,dCP);
getch();
}
else {
printf("r=%f, x=%f, y=%f, dAP=%f, dBP=%f, dCP=%f FAILURE\n",r,x,y,dAP,dBP,dCP);
}
}
}
}
} |