我用C语言写了一个很短的程序,但是,有错误。请高手指点。

2024-12-01 18:05:22
推荐回答(2个)
回答1:

int t;// cycling number
double dX;
double dY;
double dZ;
double dx;
double dy;
double dz;
double L=1;//LIMATE=dX+dY+dZ
double l;
float x1;
float x2;
float x3;
float y1;
float y2;
float y3;
float z1;
float z2;
float z3;
printf("%s","float l.x1.x2.x3.y1.y2.y3.z1.Z2.Z3");
printf("%s","double l.");
scanf("%d\n",&l);
printf("%s","float x1");
scanf("%f\n",&x1);
printf("%s","float x2");
scanf("%f\n",&x2);
printf("%s","float x3");
scanf("%f\n",&x3);
printf("%s","float y1");
scanf("%f\n",&y1);
printf("%s","float y2");
scanf("%f\n",&y2);
printf("%s","float y3");
scanf("%f\n",&y3);
printf("%s","float z1");
scanf("%f\n",&z1);
printf("%s","float z2");
scanf("%f\n",&z2);
printf("%s","float z3");
scanf("%f\n",&z3);
printf("%s","dX=");
scanf("%f\n",&dX);
printf("%s","dY=");
scanf("%f\n",&dY);
printf("%s","dZ=");
scanf("%f\n",&dZ);
while(L>=l)
{
if(L==1)
L=0;
dx=dX*x1+dY*y1+dZ*z1;//因为dX在下一步计算中还要使用所里显把结果赋给dx---这里显示:Lavlue required
dy=dX*x2+dY*y2+dZ*z2;//因为dY在下一步计算中还要使用所里显把结果赋给dy---这里显示:Lavlue required
dz=dX*x3+dY*y3+dZ*z3;//因为dZ在下一步计算中还要使用所里显把结果赋给dz---这里显示:Lavlue required
L=dx+dy+dz;//这里是要计算上面三个等式的总输出=L---这里显示:Lavlue required
dx=dX;
dy=dY;
dz=dZ;
t=t+1;
}
printf("Limmate=%lf",L);
printf("CALCULAT TIMES=%lf",t);
没有弄清赋值号
少了注释号
%s是用来输出字符串的

回答2:

L=dx+dy+dz;