From: comicfanzine@gmail.com
Subject: Re: Re : Simple call of Procedure with Ada.float_text_IO.Get
Date: Wed, 4 Nov 2015 06:37:12 -0800 (PST)
Date: 2015-11-04T06:37:12-08:00 [thread overview]
Message-ID: <712a7645-1ae2-49fd-828a-28f66eb2291e@googlegroups.com> (raw)
In-Reply-To: <lyk2pykqey.fsf@pushface.org>
Le mercredi 4 novembre 2015 11:30:29 UTC+1, Simon Wright a écrit :
> comicfanzine@gmail.com writes:
>
> >> The first one reads from standard input (the ARM doesn't explicitly say
> >> this), and leaves standard input positioned after the last character of
> >> the float number read.
> >>
> >> The second one reads from the string From, and Last contains "the index
> >> value such that From(Last) is the last character read" (not sure if
> >> that's the last character of the number, or one past it, I'd have to
> >> experiment).
> >>
> >> So which do you want?
>
> > The first one because i don't want procedure get to read a String , i
> > only want it to read a numeric_literal(float input) enter by the user
> > of the program .
>
> Well then,
>
> F : Float;
> begin
> Get (Item => F);
OK i had correct my files and i also rename the procedure "Get_float" by "receive_float" , my problem is how to declare a variable in a packagefile.ads ??
More precisely : I don't want to declare "virgules" in my "log_in" file but in my "identification.ads" file .
If you read the files you will understand :
==================
with Ada.Text_IO;
with Identification;
-- File : log_in.adb
Procedure log_in is
Password : Identification.Password_Value;
begin
Identification.Get (Password => Password);
if Password = "admin" then
Ada.Text_IO.Put_Line (Item => "Welcome, Administrator.");
end if;
Identification.receive_float(virgules);
-- error : "virgules" is undefined (more references follow)
-- Ok but then how to defined it into identification.ads ??
-- I tried like this : "virgules : Float" . But it doesn't work .
if virgules'Valid then
Ada.Text_IO.Put_Line("A float number was not asked") ;
end if; end log_in;
===========================
with Ada.Text_IO;
with Ada.float_text_IO;
-- file : identification.ads
package identification is
subtype Password_Value is String (1..5);
procedure Get (Password : out Password_Value);
procedure receive_float (virgules : float);
end identification;
======================
with Ada.Text_IO;
with Ada.float_text_IO;
-- File : identification.adb
package body identification is
procedure receive_float (virgules : float) is
virgules : Float ;
begin
Ada.float_text_IO.get(Item => virgules);
Ada.Text_IO.Skip_Line;
end receive_float;
procedure Get (Password : out Password_Value ) is
begin
Ada.Text_IO.Put (Item => "Hello, User. What's your name? ");
Get_Name : declare
Name : String := Ada.Text_IO.Get_Line;
begin
if Name /= "codezero1" then
Ada.Text_IO.Put_Line (Item => "You're not Administrator.");
receive_float;
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;
next prev parent reply other threads:[~2015-11-04 14:37 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
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 [this message]
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