Re: Problems with Ada.Text_IO and strings.
From: Ludovic Brenta (ludovic.brenta_at_insalien.org)
Date: 10/16/03
- Next message: Chad R. Meiners: "Re: Ada and MidiShare"
- Previous message: aleistad: "Re: Ada and MidiShare"
- In reply to: CheGueVerra: "Re: Problems with Ada.Text_IO and strings."
- Next in thread: Jeffrey Carter: "Re: Problems with Ada.Text_IO and strings."
- Reply: Jeffrey Carter: "Re: Problems with Ada.Text_IO and strings."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Oct 2003 00:00:51 +0200
"CheGueVerra" <chegueverra@hotmail.com> writes:
> While I've bookmarked the link you posted, and am very thankfull, the thing
> is I don't believe I can use external libs for the homework, But at the same
> time if I have a String variable that is declared (1..20) Well, I don't
> wnat the user to insert all blank spaces after his(her) name and not one
> more because it will enter the buffer of the other string !! I want to
> understand, but I guess I'm seeing things to C or C++ like still, and have
> to reteach my brain how to think, but it's hard to grasp everything when
> your just entering Names and addresses
>
> CheGueVerra
I'm not going to post working code and do your homework for you, but
here are hints you may find useful.
Hint 1:
declare
S : String (1 .. 20);
Last : Natural;
begin
Ada.Text_IO.Get_Line (S, Last); -- User's input is S (S'First .. Last)
end;
Hint 2: if Last = S'Last, then you will want to call
Ada.Text_IO.Get_Line again to read the rest of the input, and
concatenate this to S.
Hint 3: recursive calls are your friends.
HTH
-- Ludovic Brenta.
- Next message: Chad R. Meiners: "Re: Ada and MidiShare"
- Previous message: aleistad: "Re: Ada and MidiShare"
- In reply to: CheGueVerra: "Re: Problems with Ada.Text_IO and strings."
- Next in thread: Jeffrey Carter: "Re: Problems with Ada.Text_IO and strings."
- Reply: Jeffrey Carter: "Re: Problems with Ada.Text_IO and strings."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|