comp.lang.ada
 help / color / mirror / Atom feed
From: sc297 <sc297@brighton.ac.uk>
Subject: sort function
Date: Fri, 04 May 2001 13:52:08 +0100
Date: 2001-05-04T12:52:09+00:00	[thread overview]
Message-ID: <3AF2A5F8.63668DBD@brighton.ac.uk> (raw)

help . ive written a sort funtion, but for the life of me i cant work
out what i have done wrong. help me ada people

with ada.text_io, ada.integer_text_io;
use ada.text_io, ada.integer_text_io;


procedure sort( Data: in out Vector ) is
Type Vector is array( Positive Range <> ) of Integer;


temp : integer:=0;
status : boolean := false;
swap:integer:=0;
Begin
while status /= true loop
  For I in data'first..data'last-1 loop
    If data(I)>data(I+1) then
      temp:=data(I);
      data(I):=data(I+1);
      data(I+1):=temp;
        swap:=swap+1;
    Else
      Null;
    End if;

    If swap = 0 then
      Status := true;
    Else
      Status:=false;
    End if;
  End loop;
swap:=0;
End loop;
End sort;




             reply	other threads:[~2001-05-04 12:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-04 12:52 sc297 [this message]
2001-05-04 15:05 ` sort function Simon Pilgrim
2001-05-04 16:49 ` Jeffrey Carter
2001-05-08 15:21   ` John English
2001-05-09  5:44     ` tmoran
replies disabled

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