From: "bklungle" <bklungle@ix.netcom.com>
Subject: Re: New to ADA
Date: 1997/11/07
Date: 1997-11-07T01:10:39-08:00 [thread overview]
Message-ID: <63uluf$c20@sjx-ixn8.ix.netcom.com> (raw)
In-Reply-To: 346261AE.1B1F@erols.com
Dennis;
Here is your code modified. It compiles and runs on gnat-3.09 for Linux
with gnat.io; use gnat.io;
with text_io;
procedure get_date is
type month_name;
type month_name is (Jan, Feb, Mar, Apr, May, Jun, Jly, Aug, Sep, Oct, Nov,
Dec);
-- Hasn't anyone mentioned enumeration io to you yet??
package eio is new text_io.enumeration_io(month_name);
use eio;
type date_record;
type date_ptr is access all date_record;
type date_record is
record
day: integer range 1..31;
month: month_name; -- This is an enumeration
year: integer;
end record;
D,date_rec: date_ptr;
-- I took off the .all dereferences. Not needed because only referencing
-- discrete member
begin
put("Please enter the desired date ");
date_rec := new date_record;
D := date_rec;
get(D.day);
put("Enter Month ");
get(D.month);
put("Enter Year ");
get(D.year);
new_line;
put("Date entered is ");
put(D.day);
put("-");
put(D.month);
put("-");
put(D.year);
new_line;
end get_date;
Dennis East wrote in message <346261AE.1B1F@erols.com>...
>Need some assistance getting started in ADA
>In the following procedure I am getting
>"invalid parameter list in call"
>just trying to get a 3 character month string, and have made several
>changes but seem to get one error followed by another.
>
>-- Procedure to get the date in the format dd,mmm,yyyy
>
>with gnat.io; use gnat.io;
>procedure get_date is
>
>type month_name;
>type month_name is (Jan, Feb, Mar, Apr, May, Jun, Jly
> , Aug, Sep, Oct, Nov, Dec);
>mon: month_name;
>
>type date_record;
>type date_ptr is access all date_record;
>type date_record is
> record
> day: integer range 1..31;
> month: month_name;
> year: integer;
> end record;
>
>D,date_rec: date_ptr;
>
>begin
> put("Please enter the desired date ");
> date_rec := new date_record;
> D := date_rec;
> get(D.all.day);
> put("Enter Month ");
> get(D.all.month); -- Error occurs here
> D.all.month:=mon;
> put("Enter Year ");
> get(D.all.year);
> new_line;
> put("Date entered is ");
> put(D.all.day);
> put("-");
> put("D.all.month");
> put("-");
> put(D.all.year);
> new_line;
>end get_date;
>
>It is possible I'm overlooking the obvious, so another solution could be
>used also. In final package I will need to input name strings into a
>linked list record, so I need something similar that works.
>
>Thanks for any assistance.. Dennis
>
next prev parent reply other threads:[~1997-11-07 0:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-06 0:00 New to ADA Dennis East
1997-11-07 0:00 ` bklungle [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-09-12 8:42 New to Ada mig20022000
2017-09-12 11:44 ` Luke A. Guest
2017-09-12 12:49 ` Lucretia
2017-09-12 14:59 ` Brian Drummond
2017-09-12 16:40 ` Johan Söderlind Åström
2017-09-12 18:21 ` Jeffrey R. Carter
2017-09-14 6:42 ` Petter Fryklund
2017-09-14 11:52 ` Lucretia
2017-09-15 5:17 ` Petter Fryklund
2017-12-23 22:14 ` Yves Cloutier
2017-09-15 22:54 ` Jere
2002-10-28 6:36 New to ADA Bill Cunningham
2002-10-28 6:47 ` Jim Rogers
2002-10-28 7:02 ` Bill Cunningham
2002-10-28 21:20 ` Dennis Lee Bieber
2002-10-28 22:22 ` Michal Nowak
2002-10-29 10:15 ` Colin Paul Gloster
2002-09-04 5:21 New to Ada Bill Cunningham
2002-09-04 6:52 ` Pascal Obry
2002-09-04 12:37 ` Georg Bauhaus
2002-09-04 13:20 ` Pascal Obry
2002-09-04 19:01 ` Jeffrey Carter
2002-09-04 10:50 ` Preben Randhol
2002-09-04 12:05 ` Larry Kilgallen
2002-09-04 11:10 ` Preben Randhol
1995-01-19 7:57 New to ADA John Mackaay
1994-10-03 1:24 New to ada Seth Hettich
1994-10-03 5:03 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox