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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,98e6b29260f70dc7 X-Google-Attributes: gid103376,public From: "M. Kotiaho" Subject: Re: Help!! program doesnt run, has 0 errors Date: 2000/08/15 Message-ID: <39998CC2.A07B01F1@NULL.lmco.com>#1/1 X-Deja-AN: 658625460 Content-Transfer-Encoding: 7bit References: <39991c02$0$17111@echo-01.iinet.net.au> <399920FE.556AD44F@Physik.Uni-Magdeburg.de> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Lockheed Martin Missiles and Fire Control - Dallas Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-08-15T00:00:00+00:00 List-Id: Gerald Kasner wrote: > Damon Carter schrieb: > > > > I have written a get_valid_integer procedure that gets the input from the > > user, an integer between 1 and 40, > > I can't find any "Get" procedure in your code > > > then outputs to the user the number they > > have entered if it was within the correct range and if not then it raises a > > range_error and loops so the user can re-enter the number. > > Your procedure calls itself ??? have a closer look at this line ..... > > > When compiled the > > program has no errors but i cant get it to run.. can anyone help.. i have > > attached the source code thanx > > > > > Compiler ? switches ? platform ? > > Name: get_valid_integer.adb > > get_valid_integer.adb Type: Ohne Angabe (application/octet-stream) > > Encoding: x-uuencode > > I suggest to have a look at some Ada-book, Feldman&Koffman or Skansholm > > -Gerald In addition to these problems, it is likely that when you compile your procedure, you are not actually getting an executable file -- just an object file. A main Ada program must be parameterless. If you are trying to use command line arguments, you need to implement some OS specific code. If you want your program to run as is, you could try enclosing it in a main procedure, something like: with Text_Io; procedure Show_Me_The_Bugs is The_Integer : integer; procedure Get_Valid_Integer (The_Integer : out Integer; ... ... end Get_Valid_Integer; begin Get_Valid_Integer (The_Integer); end Show_Me_The_Bugs; Of course, even if this does compile and run, it is not going to do what you wanted it to do. I'm guessing you might see output like: Please enterany integer value > 0 and < 41 Please enterany integer value > 0 and < 41 Please enterany integer value > 0 and < 41 Please enterany integer value > 0 and < 41 Please enterany integer value > 0 and < 41 Please enterany integer value > 0 and < 41 ... ... There is no place in your code that you do a "get" from the user. As Mr. Kasner suggested, you should probably take a look at an Ada textbook ... just about any one should suffice. -- MK