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-21 23:20:09 PST Path: supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-sjo.usenetserver.com!news-out.usenetserver.com!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: HOW TO FIX THIS IN ADA? References: <6Izk6.161065$Pm2.3005370@news20.bellglobal.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Thu, 22 Feb 2001 07:17:55 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 982826275 24.20.190.201 (Wed, 21 Feb 2001 23:17:55 PST) NNTP-Posting-Date: Wed, 21 Feb 2001 23:17:55 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:5418 Date: 2001-02-22T07:17:55+00:00 List-Id: > 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.