comp.lang.ada
 help / color / mirror / Atom feed
From: Andre <avsaway@hotmail.com>
Subject: Re: Another problems of newbie
Date: Thu, 30 Dec 2004 16:30:06 +0100
Date: 2004-12-30T16:30:06+01:00	[thread overview]
Message-ID: <cr16tr$e2t$1@news2.tilbu1.nb.home.nl> (raw)
In-Reply-To: <cr1ah6.1dk.1@cs.chip.komp.fan.pl>

maxsio ;D wrote:
> I need to write some program and I have problems with it. This program 
> should read text file, write words to array, sort them and than write to 
> another text file. In one book I found way how to read only singel char 
> so I thought it would be easy to link singel char and rest part of final 
> word, but I was wrong. I've written this subprogram (this program is 
> reading from keyboard, but with files is similar so...) :
> *
> 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;
> *
> but after first letter program generate constraint error. And second 
> problem which I have is sorting array with words. To sort array I've 
> choosen QuickSort, but I don't know totally how to use it in Ada. I was 
> searching in Google, but I found only QuickSort with pointers. 
> Unfortunately I don't understand how to use them good ind this 
> algorithm. If anybody could explain usage of pointers in this algorithm 
> or write QuickSort without pointers I'd be grateful.
> Sorry for my poor English and thanks in advance. Greetings
> 
> maxsio

word:=word&(string(char)) is a concatenation of the string word and the 
char. This requiers a sting of 1 .. 32.

what you want is:
    word (i) := char;

Andr�


  reply	other threads:[~2004-12-30 15: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 [this message]
2004-12-30 18:30 ` Jeffrey Carter
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