I got a double error 200 : Division by zero! Help please.

Hi! I got this code from one of my friend, and he asked me to translate it into another language. Problem is, when i test run them (with the TP7.0 fixed to avoid error 200) , I got another, exactly same error when the program attempt to draw something. (I tripple check the code, both the variables in the calculation are not 0). Is there anyway to fix it please ?

[code]
PROGRAM SS12(INPUT,OUTPUT);
uses crt,graph;
LABEL 1,2;
{declare variables}
BEGIN
ClrScr;
assign(fv,'c:usertbTG2.TG');{$I-} Reset(fv) {$I+};
readln(fv,n1,q1);
READLN(FV,RMR);
READLN(FV,NTD);
FOR JTD:=1 TO NTD do BEGIN
readln(fv,stt);readln(fv,z);
readln(fv,rr[jtd]);WRITELN(stt,' ',z,' ',rr[jtd]:8:4);
readln(fv,tl[jtd]);
readln(fv,gama[jtd],a1[jtd],a2[jtd]);
READLN(FV,bvao[jtd],bra[jtd],bvo[jtd]);
readln(fv,vu1[jtd],vz[jtd],vu2[jtd],wm[jtd],om,hk[jtd]);
READLN(FV,dm,dr[jtd]);
readln(fv,sdn[jtd]);
readln(fv,goc[jtd]);
READLN(FV,sgdb[jtd],ctx[jtd],cty[jtd]);
for i:=1 to 26 do BEGIN
read(fv,ipt[jtd,i],ur[jtd,i],zr[jtd,i],ur[jtd,i+25],zr[jtd,i+25],
xg[jtd,i],yg[jtd,i],cgy[jtd,I]); READLN(FV);END;READLN(FV);
END;
chuan:=800;chuan1:=400;
2: FOR JTD:=1 TO ntd DO BEGIN
r:= rr[jtd];
FOR I:=1 TO 26 DO BEGIN
G:=XG[JTD,I]/R; {error is here , division by 200}
XG1[JTD,I]:=R*COS(G);
YG1[JTD,I]:=-R*SIN(G);
g:=g-pi/5;
xg2[jtd,i]:=r*cos(g);yg12[jtd,i]:=-r*sin(g);END;
END.
[/code]

Comments

  • It would help if you posted the complete program. You have a comment "{declare variables}" which I assume means that your original code declares variables, but what you've posted does not. What you've posted does not compile.

    You seem to have a "begin" without a corresponding "end." There are 5
    "begin"s and only 4 "end"s.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion