comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Another problems of newbie
Date: Thu, 30 Dec 2004 18:30:18 GMT
Date: 2004-12-30T18:30:18+00:00	[thread overview]
Message-ID: <_OXAd.2484$Cc.1582@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <cr1ah6.1dk.1@cs.chip.komp.fan.pl>

maxsio ;D wrote:

> procedure chars is
>   word : string(1..31);
>   char : character;
> 
> begin
>   for i in 1..30 loop
>     Get(char);
>     word:=word&(string(char));
>   end loop;
>   Put(word);
>   delay 10.0;
> end chars;

You have some basic misunderstandings. A String is just an array, so to 
assign anything to Word, it must be exactly 31 Characters long. Why 31, 
when you're only reading 30 Characters? Word (31) is undefined.

Presumably you're doing this to learn Ada. You should work through a 
text or tutorial so you understand the basics of the language before 
working on anything like this. Then when you have problems they'll be at 
a suitable level for asking here. You can find both texts and tutorials 
on line at adapower.com and adaworld.com.

When you do get to that level, you'll find that reading words is already 
done for you. See PragmARC.Word_Input and the various sorting packages 
that are part of the PragmAda Reusable Components. The PragmARCs are 
available from

http://home.earthlink.net/~jrcarter010/pragmarc.htm

-- 
Jeff Carter
"Now look, Col. Batguano, if that really is your name."
Dr. Strangelove
31



  parent reply	other threads:[~2004-12-30 18:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-30 15:31 Another problems of newbie maxsio ;D
2004-12-30 15:30 ` Andre
2004-12-30 18:30 ` Jeffrey Carter [this message]
2004-12-31  7:04 ` Martin Krischik
2004-12-31 13:50   ` Pascal Obry
2004-12-31 14:59     ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox