From: comicfanzine@gmail.com
Subject: Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
Date: Mon, 2 Nov 2015 06:46:27 -0800 (PST)
Date: 2015-11-02T06:46:27-08:00 [thread overview]
Message-ID: <39131715-ea95-4188-93a1-a9819aa5472b@googlegroups.com> (raw)
In-Reply-To: <87h9l4eeon.fsf@adaheads.sparre-andersen.dk>
Le lundi 2 novembre 2015 14:03:39 UTC+1, Jacob Sparre Andersen a écrit :
> You say that you understand the error messages. What do they mean?
They mean that i don't use the "Procedure Get" right , i understand but i don't know how to fix it .
> PS: Please format your code nicely - and mark the position the error
> message refers to - before posting it.
Here is the code whith errors included , the presentation is better if you copy-paste it into your text-editor:
============
with Ada.Text_IO;
with Identification;
-- File : log_in.adb
Procedure log_in is
Procedure check_password is
Password : Identification.Password_Value;
begin
Identification.Get (Password => Password);
if Password = "admin" then
Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
end if;
end check_password;
virgules : Identification.virgules_Value ;
begin
check_password;
-- Here i want the procedure check_password be executed before log_in , for the arguments given to Ada.float_text_IO.Get
Identification.Get (virgules => virgules);
-- error : missing argument for parameter "From" in call to "get" declared at identification.ads:8
-- error : missing argument for parameter "Password" in call to "get" declared at identification.ads:7
if virgules'Valid then
Ada.Text_IO.Put_Line("A float number was not asked") ;
end if; end log_in;
============
with Ada.Text_IO;
-- File : identification.adb
package body identification is
procedure Get (Password : out Password_Value ) is
procedure Get
(From : in Password_Value;
Item : out virgules_Value;
Last : out Positive_package_declaration_need); is
begin
Ada.float_text_IO.get(Item => virgules); Skip_line ;
end Get;
begin
Ada.Text_IO.Put (Item => "Hello, User. What's your name? ");
Get_Name : declare
Name : constant String := Ada.Text_IO.Get_Line;
begin
if Name /= "fanzine" then
Ada.Text_IO.Put_Line (Item => "You're not Administrator.");
procedure Get
(From : in Password_Value;
Item : out virgules_Value;
Last : out Positive_package_declaration_need);
else
Ada.Text_IO.Get (Item => Password);
Ada.Text_IO.Skip_Line;
Ada.Text_IO.New_Line;
end if;
end Get_Name;
end Get;
end identification;
===================
-- File : identification.ads
package identification is
subtype Password_Value is String (1..5);
subtype virgules_Value is Float ;
subtype Positive_package_declaration_need is Positive ;
procedure Get (Password : out Password_Value);
procedure Get
(From : in Password_Value;
Item : out virgules_Value;
Last : out Positive_package_declaration_need);
-- "Last" is in the declaration in Ada.float_text_IO.Get , i don't know if i can , not use it and if it silll going to work after that .
end identification;
===================
> PPS: Which textbook (or other sources) are you using to learn Ada? I
> think it might be useful, if you tried to work through the
> exercises in <http://www.dwheeler.com/lovelace/> before continuing
> your own Ada project.
Thanks , i learn with many textbooks , but right now , i'm trying to use the fonctions in Ada.text_io(like Ada.float_text_IO.Get) right .
next prev parent reply other threads:[~2015-11-02 14:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 12:33 Re : Simple call of Procedure with Ada.float_text_IO.Get comicfanzine
2015-11-02 13:03 ` Jacob Sparre Andersen
2015-11-02 14:46 ` comicfanzine [this message]
2015-11-02 17:23 ` Jacob Sparre Andersen
2015-11-02 21:51 ` comicfanzine
2015-11-02 23:02 ` AdaMagica
2015-11-03 11:42 ` comicfanzine
2015-11-03 11:52 ` comicfanzine
2015-11-03 18:40 ` comicfanzine
2015-11-03 19:02 ` Jeffrey R. Carter
2015-11-03 20:27 ` Simon Wright
2015-11-03 23:14 ` comicfanzine
2015-11-03 23:36 ` comicfanzine
2015-11-04 10:30 ` Simon Wright
2015-11-04 12:39 ` comicfanzine
2015-11-04 14:37 ` comicfanzine
2015-11-04 16:06 ` Simon Wright
2015-11-03 6:44 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox