From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,81080984e3a87d27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-22 08:44:08 PST Path: supernews.google.com!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Al Christians Newsgroups: comp.lang.ada Subject: Re: HOW TO FIX THIS IN ADA? Date: Thu, 22 Feb 2001 08:43:52 -0800 Organization: Trillium Resources Corporation Message-ID: <3A9541C8.D828D9D7@PublicPropertySoftware.com> X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 References: <6Izk6.161065$Pm2.3005370@news20.bellglobal.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse@supernews.com Xref: supernews.google.com comp.lang.ada:5442 Date: 2001-02-22T08:43:52-08:00 List-Id: That code looks like pascal. tmoran@acm.org wrote: > > > with Ada.Text_IO; use Ada.Text_IO; > Ada.Text_IO is never used in this program. > > > > PROCEDURE Random(Output) IS ; > what kind of parameter is Output? in, out, integer, float, ??? > It's never referenced in the program anyway > The ';' is illegal and should be dropped > > seed1 = 5; seed2 = 10000; seed3 = 3000; > Presumably these '=' are supposed to be ':='? But of course > none of seed1, seed2, or seed3 has been declared. Given the > later use, perhaps these should be "seed1 : constant integer := 5;" etc > > x, y, z : integer; > > looop : integer; > 'looop' is never used. > > FUNCTION Unif return real is > > tmp : real; > I see no type declaration for 'real' - probably meant 'float' > > Begin > > x := 171*(x mod 177) - 2*(x div 177); > There is no 'div' operator. Since x is integer, x/177 does the job. > > if x<0 then x := x + 30269; > Is there supposed to be an 'end if;' here, or is it supposed to be elsewhere? > > y := 172*(y mod 176) -35*(y div 176); > There is no 'div' operator. Since y is integer, y/176 does the job. > > if y<0 then y := y + 30307; > Is there supposed to be an 'end if;' here, or is it supposed to be elsewhere? > > z := 170*(z mod 178) -63*(z div 178); > There is no 'div' operator. Since z is integer, z/178 does the job. > > if z<0 then z := z + 30323; > Is there supposed to be an 'end if;' here, or is it supposed to be elsewhere? > > tmp := x/30269.0 + y/30307.0 + z/30323.0; > Since x, y, and z are Integer, this is illegal. Probably want 'float(x)' etc > > Unif := tmp - trunc(tmp); > Where is function 'trunc' defined? > Where is a 'return' statement and what should it return? > > End; {Unif} > '{Unif}' is not Ada. Probably meant "End Unif;" > > BEGIN > > x := seed1; y := seed2; z := seed3; > > for looop := 1.. 1000 loop > The ":=" is wrong, should be "in" > The for-loop will automatically declare a new variable for its index > 'looop' - it will not use the one declared above > > writeln(loop:4, ' ==> ', unif:7:5); > What do "loop:4" and "unif:7:5" mean? > multicharacter strings are delimited with ", single character literals > with ' So this probably should be " ==> " > The string concatenation operator is '&', eg onething & " ==> " & another > There is no procedure "writeln" declared anywhere. > Probably this is meant to be "put", or "put_line", in which case > the line with-ing Ada.Text_IO should be restored. > > END loop; > > END unif; > This is the end of procedure Random, not of function Unif > Get an Ada compiler and it will tell you all this much quicker than c.l.a.