Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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

Chaos0205Chaos0205 Posts: 2Member
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

  • Actor21Actor21 Posts: 35Member
    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.