comp.lang.ada
 help / color / mirror / Atom feed
* sort function
@ 2001-05-04 12:52 sc297
  2001-05-04 15:05 ` Simon Pilgrim
  2001-05-04 16:49 ` Jeffrey Carter
  0 siblings, 2 replies; 5+ messages in thread
From: sc297 @ 2001-05-04 12:52 UTC (permalink / 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;




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-09  5:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-04 12:52 sort function sc297
2001-05-04 15:05 ` Simon Pilgrim
2001-05-04 16:49 ` Jeffrey Carter
2001-05-08 15:21   ` John English
2001-05-09  5:44     ` tmoran

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