我用tc编程序,不过出现for statement missing,那里错了啊,请帮我解答一下,谢了。
#include<graphics.h>
main(){
float x[10]={50,90,120,150,220,300,320,380,450,500};
float y[10]={100,60,50,120,140,60,70,160,150,100};
int i,k,xx,yy,n=10;
int drive=DETECT,mode=0;
float dt,t;
initgraph(&drive,&mode,”");
setbkcolor(BLUE);
setcolor(YELLOW);
dt=1.0/n;
for(k=0;k<n;k++){
if(k==0)
moveto(x[k],y[k]);
lineto(x[k],y[k]);
}
for{k=0;k<n-3;k++){
x0=x[k];y0[k]; x1=x[k+1];y1=y[k+1];
x2=x[k+2];y2=y[k+2]; x3=x[k+3];y3=y[k+3];
for(i=0;i<n;i++){
t=i*dt;
xx=1.0/6*(-t*t*t+3*t*t*t-3*t+1)*x0+1.0/6*(3*t*t*t-6*t*t+4)*x1+1.0/6*(-3*t*t*t+3*t*t+3*t+1)*x2+1.0/6*t*t*t*x3;
yy=1.0/6*(-t*t*t+3*t*t*t-3*t+1)*y0+1.0/6*(3*t*t*t-6*t*t+4)*y1+1.0/6*(-3*t*t*t+3*t*t+3*t+1)*y2+1.0/6*t*t*t*y3;
if(i==0)
moveto(xx,yy);
;ineto(xx,yy);
}
}
getch();
closegraph();
}
>> 本文固定链接: http://www.vcgood.com/archives/3314