comp.lang.ada
 help / color / mirror / Atom feed
From: Alfred Hilscher <Alfred.Hilscher@icn.siemens.de>
Subject: Sort, was Re: HELP WITH SIMPLE PROGRAM PLEASE
Date: 2000/04/18
Date: 2000-04-18T00:00:00+00:00	[thread overview]
Message-ID: <38FC0D8C.2F734149@icn.siemens.de> (raw)
In-Reply-To: 8df1sn$hh4$1@nnrp1.deja.com



ashraf2000@x-stream.co.uk wrote:
> 
> HI,
> 
> I am a beginner and trying to sort numbers which are read from a file
> in random order and needs to be sorted out in numerical order.
> e.g 7,10,1,5,.... into 1,2,3,....
> Below is some code to read the number from a file and display them.
> 
> Please help me sort them out.
> begin
> read;
> check;
> output;

Ok. What you have is quite good. You read the data and you write them.
The remaining part is to sort them. Your procedure check is a good
starting point. You check two number and if they are in the wrong order
you swap them. So do this not only for no(1) and no(2) but do it for all
numbers until they are ascending. For more information on sorting
algorithms you should look into the literature, e.g. Wirth's "Algorithm
and datastructures".




      parent reply	other threads:[~2000-04-18  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-17  0:00 HELP WITH SIMPLE PROGRAM PLEASE ashraf2000
2000-04-17  0:00 ` Ted Dennison
2000-04-17  0:00 ` Robert Dewar
2000-04-18  0:00 ` Alfred Hilscher [this message]
replies disabled

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