Re: Problems with Ada.Text_IO and strings.

From: Ludovic Brenta (ludovic.brenta_at_insalien.org)
Date: 10/16/03


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.


Relevant Pages

  • Re: Gernerics Linked List
    ... LinkedList using Generics that stores only one string per node, ... I bet your teacher would appreciate it if you do your homework instead ... newsgroups operate, you will see that accusations of attempted homework ...
    (comp.lang.java.help)
  • Re: Save to hard drive and backup to thumb drive.
    ... Insert a Module in your workbook. ... ByVal lpBuffer As String) As Long ... Public Function HomeWork() ... Dim sStr As String ...
    (microsoft.public.excel.programming)
  • Re: Gernerics Linked List
    ... LinkedList using Generics that stores only one string per node, ... for the entry of a new string (and the creation of a new node), ... I am guessing that you were trying to call a249 an "ass" for encouraging you to do your own homework? ... If you study how these newsgroups operate, you will see that accusations of attempted homework plagiarism are fairly common, and are triggered by a certain demanding, perhaps even haughty tone of posts asking for complete solutions without apparent humility or explanation of effort already expended. ...
    (comp.lang.java.help)
  • Re: String Manipulation
    ... This program iterates through one file and outputs all lines to ... another file which have the word "homework" in them. ... Here is a program which turns a string containing the phrase ... And, finally, a program to remove punctuation from a string: ...
    (comp.lang.python)
  • Re: Interger_io get and Text_io.Get_line
    ... > CheGueVerra wrote: ... which before was displaying the ... > string. ... Anders ...
    (comp.lang.ada)