c语言求助 [Error] variable or field 'RRR2' declared void
#include "stdio.h"#include "math.h"
#define PI 3.141593
#define PR PI/180
static float l[6],p[6],W[6],X[6],Y[6],VX[6],VY[6],AX[6],AY[6],DA,E[6],EV,EA,b;
double s(double a)
{
return a*a;
}
int i,j,m,n,q;
void RRR2(i,j,m,n,q)
{
static double s[5],ky,kx,aa,cc,bb,su,sq,mq,c1,c2,v[5],ss;
int mm;
printf("input assembly module mm of RRR2\n");
kx=X[q]-X[m];ky=Y[q]-Y[m];
mq=sqrt(kc*kc+ky*ky);
scantf("%d",&mm);
if(mq>l[i]+l[j]||mq<fabs(l[i]-l[j]))
{ printf("RRR2 cannot assembled");return; }
else{
aa=2*l[i]*ky;bb=2*l[i]*kx;
cc=l[i]*l[i]+mq*mq-l[j]*l[j];
su=bb+cc;
if(fabs(su)<1e-10)su=1e-10;
sq=sqrt(aa*aa+bb*bb-cc*cc);
p[i]=2*actan((aa+mm*sq)/su);
X[n]=X[m]+l[i]*cos(p[i]);
Y[n]=Y[m]+l[i]*sin(p[i]);
s[3]=X[n]-X[q];s[4]=Y[n]-Y[q];
p[j]=arctan(s[4]/s[3]);
/*RRR2V*/
if(p[j]<0)p[j]=p[j]+PI;
s[1]=X[n]-X[m];s[2]=Y[n]-Y[m];
v[1]=(VX[q]-VX[m])*s[1];
v[2]=(VY[q]-VY[m])*s[2];
v[3]=(VX[q]-VX[m])*s[3];
v[4]=(VY[q]-VY[m])*s[4];
ss=s[1]*s[4]-s[2]*s[3];
if(ss<1e-10)ss=1e-10;
W[i]=(v[3]+v[4])/ss;
W[j]=(v[1]+v[2])/ss;
VX[n]=VX[m]-W[i]*s[2];
VY[n]=VY[m]-W[i]*s[1];
/*RRR2a*/
c1=AX[q]-AX[m]+W[i]*W[i]*s[1]-W[j]*W[j]*s[3];
c2=AY[q]-AY[m]+W[i]*W[i]*s[2]-W[j]*W[j]*s[4];
E[i]=(c1*s[3]+c2*s[4])/ss;
E[j]=(c1*s[1]+c2*s[2])/ss;
AX[n]=AX[m]-W[i]*W[i]*s[1]-E[i]*s[2];
AY[n]=AY[m]-W[i]*W[i]*s[2]-E[i]*s[1];
return;
}
}
void double point (i,j,a,m)
int i,j,a,m;
{
float pp,kc,ks;
pp=p[j]+da;kc=l[i]*cos(pp);ks=l[i]*sin(pp);
x[m]=x[a]+ks;
y[m]=y[a]=ks;
vx[m]=vx[a]-w[j]*ks;vy[m]=vy[a]*kc;
ax[m]=ax[a]-w[j]*w[j]*kc-e[j]*ks;
ay[m]=ay[a]-w[j]*w[j]*ks-e[j]*kc;
return;
}
main ()
{
double AL,co,PA,po;
void paint1(),RRR2();
l[4]=0.085,l[3]=0.045,l[2]=0.05,l[1]=0.035;
W[1]=10;AL=138.0;X[4]=0.085;X[1]=0;Y[1]=0;VY[1]=0;AX[1]=0,AY[1]=0,E[1]=0;
co=(s(l[1])+s(l[4])-s(l[3]+l[2]))/(2*l[1]*l[4]);
PA=atan(sqrt(1-s(co))/co);
if(PA<0)PA=PA+PI;
l[5]=sqrt(s(0.05)+s(0.03));
AL=AL*PR;
printf("jingdo P1 EV EA W2 W3 E2 E3\n");
for(po=0;po<PI;po+=PI/12)
{
p[1]=po,DA=0;
point1()
}
}
主函数还没有写完,但是为什么子函数报错,改了半天,都没有办法