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
| #include <stdlib.h>
#include <stdio.h>
int main (void)
{
float pas=0.1;
int i=1,j=0,k=1;
float x,y,r;
float dAP[1365][610], dBP[1365][610], dCP[1365][610];
float precision=0.00001;
for (i;i<=1365;i++)
{
for (j;j<=610;j++)
{
x=i*pas*cos(60);
r=x/cos(j*pas);
y=r*sin(j*pas);
dAP[i][j]=sqrt(x*x+y*y);
dBP[i][j]=sqrt((x-273)*(x-273)+y*y);
dCP[i][j]=sqrt((x-136,5)*(x-136,5)+(y-273*sin(60))*(y-273*sin(60)));
for (k;k<=1365;k++)
{
if ( ( ((k-precision)<=dAP[i][j] )&&( (k+precision)>=dAP[i][j]) )
&&( ((k-precision)<=dBP[i][j] )&&( (k+precision)>=dBP[i][j]) )
&&( ((k-precision)<=dCP[i][j] )&&( (k+precision)>=dCP[i][j]) ) )
{
printf("dAP=%f\n",dAP[i][j]);
printf("dAP=%f\n",dBP[i][j]);
printf("dAP=%f\n",dCP[i][j]);
getch();
}
else {
printf("r=%f, x=%f, y=%f, dAP=%f, dBP=%f, dCP=%f FAILURE\n",r,x,y,dAP[i][j],dBP[i][j],dCP[i][j]);
}
}
}
}
} |
Partager