|
![]() | 作者: wskli [wskli]
![]() |
登录 |
采用“点线式”的动画方试,用背景运动来模拟火车在铁轨上行进! 编写程序如下:可我不知道是那里错了,总是编译不出来~ 唯一的就只有这个“error 85: ";"expected. program wskli 10; uses crt,graph; const m=40; type aty=array[1..m,1..2]of integer; crty=array[1..4,1..3]of integer; var sy:aty; cxyr:crty; gd,gm,mx,my,ii:integer; procedure readf(var xy:aty;var cxyr:crty;ii:integer); var f:file of integer; i:integer; begin assign(f,'data 10.dat'); if ii=0 then begin rewrite(f); writeln('inptu x,y=?'); for i:=1 to m do begin readln(xy[i,1],xy[i,2]); write(f,xy[i,1],xy[i,2]); end; writeln('input xc,yc,r=?'); for i:=1 to 4 do begin readln(cxyr[i,1],cxyr[i,2],cxyr[i,3]); write(f,cxyr[i,1],cxyr[i,2],cxyr[i,3]); end; close(f); end else begin reset(1); for i:=1 to m do read(f,xy[i,1],xy,[i,2]); for i:=1 to 4 do read(f,cxyr[i,1],cxyr[i,2],cxyr[i,3]); close(f); end end; procedure clr; begin setfillstyle(1,getbkcolor); bar(11,11,mx-11,39); end; procedure display(var xy:aty;var cxyr:crty); var i,j,xc,yc,xb,yb,radius,xstart,x:integer; da,angle:real; begin moveto(xy[1,1],xy[1,2]); for i:=2 to 26 do lineto(xy[1,1],xy[1,2]); setfillstyle(emptyfill,getcolor); bar(xy[27,1],xy[27,2],xy[28,1],xy[28,2]); j:=0; for i:=1 to 6 do begin line(xy[29+j,1],xy[29+j,2],xy[30+j,1],xy[30+j,2]); j:=j+2; end; for i:=1 to 4 do begin xc:=cxyr[i,1];yc:=cxyr[i,2]; circle(xc,yc,cxyr[i,3]); end; radius:=15; xstart:=0; da:=50*3.14159/180; repeat angle:=da; while angle<=6.28318 do begin xb:=xc+round(radius*sin(angle)); yb:=yc+round(radius*cos(angle)); line(xb,yb,xb-90,yb); x:=xstart; whilex <=319 do begin putpixel(x, 152,getcolor); x:=x+35; end; x:=xstart; while x<=319 do begin putpixel(x,152,getbkcolor); x:=x+35; end; xstart:=xstart+7; if xstart>=30then xstart:=0; setcolor(getbkcolor); line(xb,yb,xb-90,yb); setcolor(green); angle:=angle+da; end until keypressed; end; begin gd:=detect; initgraph(gd,gm,"); if graphresult<>grok then halt(1); setbkcolor(black); setcolor(green); clr; outtextxy(15,20,'first ii=0 else ii=1'); gotoxy(30,2);readln(ii); readf(xy,cxyr,ii); clearviewport; display(xy,cxyr); closegraph; end. [此贴被 浪迹天涯(wskli) 在 06月11日14时48分 编辑过] |
地主 发表时间: 04-06-11 14:44 |
![]() | 回复: 286 [unique] ![]() |
登录 |
少一个“;”。 根据我的经验,一般少分号的地方往往是系统提示出错行的前现一行或几行。 另外if xstart>=30then象这种连想来的不知道算不算错。 |
B1层 发表时间: 04-06-11 15:13 |
![]() | 回复: wskli [wskli] ![]() |
登录 |
我看过了,应该加的我都加了,可还是提示那个错误! |
B2层 发表时间: 04-06-11 16:44 |
![]() | 回复: wskli [wskli] ![]() |
登录 |
怎么不回了,我还等着呢! |
B3层 发表时间: 04-06-11 20:50 |
![]() | 回复: wskli [wskli] ![]() |
登录 |
帮帮忙嘛,版主,我不知道是错在那里,你说的我都改了可还是不行! |
B4层 发表时间: 04-06-12 22:57 |
![]() | 回复: windflower [windflower] ![]() |
登录 |
倒数18行 |
B5层 发表时间: 04-06-12 23:59 |
![]() | 回复: wskli [wskli] ![]() |
登录 |
是没加分号嘛? |
B6层 发表时间: 04-06-13 12:54 |
![]() | 回复: zjs_wy1234 [zjs_wy1234] ![]() |
登录 |
其实并不是没有加分号!~ |
B7层 发表时间: 04-06-17 19:28 |
![]() | 回复: wskli [wskli] ![]() |
登录 |
那请问是什么原因呀,小弟先谢了! |
B8层 发表时间: 04-06-18 14:11 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号