From: steved@199.2.117.161 (Steve Doiel)
Subject: Re: Please help a beginner! (second try)
Date: 1996/02/18
Date: 1996-02-18T00:00:00+00:00 [thread overview]
Message-ID: <4g675n$dm4@news.pacifier.com> (raw)
In-Reply-To: 4g517q$438@helios.herts.ac.uk
In <4g517q$438@helios.herts.ac.uk>, kst1ju@herts.ac.uk (Ryan) writes:
>
>Could somebody please help me with what I am sure is a simple
>problem. I need to do some basic text and integer IO. Apparently
>I need the TEXT_IO library for this - it is on my system, and
>I believe I am using it in the following code. However, when I
>compile the program, the errors mentioned in the comments are
>given out :
>
>with TEXT_IO;
>package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER);
>with INT_IO;
>
>procedure proc1 is
>begin
> TEXT_IO.PUT("Hello");
>-- fails ... "TEXT_IO not defined"
> INT_IO.PUT(2);
>-- accepted
>end proc1;
>
>procedure main is
>begin
> TEXT_IO.PUT("Hello");
>-- fails ... "TEXT_IO not defined"
> INT_IO.PUT(2);
>-- fails ... "INT_IO not defined"
>end main;
>
>
[snip]
> Thanks,
>
> Nigel.
I too come from a Pascal background and have shifted toward Ada. I did
some slight re-arranging of your code, and the following compiles and runs
under GNAT 3.01 on OS/2. It may not be exactly what you wanted, but it
gives the output: Hello 2
with TEXT_IO;
procedure main is
package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER);
procedure proc1 is
begin
TEXT_IO.PUT("Hello");
INT_IO.PUT(2);
end proc1;
begin
TEXT_IO.PUT("Hello");
INT_IO.PUT(2);
end main;
In simple terms, the main program in Pascal is something like:
PROGRAM Main( input, output );
BEGIN
END.
Well, in Ada the main program is a procedure:
PROCEDURE Main IS
BEGIN
END Main;
All the WITH's go before the main procedure heading.
Hope this helps!
Steve Doiel
next prev parent reply other threads:[~1996-02-18 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-02-17 0:00 Please help a beginner! (second try) Ryan
1996-02-17 0:00 ` smoneill
1996-02-17 0:00 ` Robert Dewar
1996-02-18 0:00 ` Steve Doiel [this message]
1996-02-18 0:00 ` Robert Dewar
1996-02-19 0:00 ` Arthur Evans Jr
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox