Yurttas/PL/IL/Ada-95/Sort/BSort/bsortif a 00.adb

From ZCubes Wiki
Jump to navigation Jump to search
 1--
 2-- Copyright (C) 1998
 3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4--
 5-- Permission to use, copy, modify, and distribute this 
 6-- software and its documentation for EDUCATIONAL purposes
 7-- and without fee is hereby granted provided that this 
 8-- copyright notice appears in all copies. 
 9-- 
10-- 
11 
12-- date   : January 1, 1998.
13-- author : Salih Yurttas.
14
15-- purpose : sorting of a list of integers/floats in ascending order
16--           using Bubble-Sort.
17
18-- bsortif_a_00.adb
19
20
21with ListIF_P;   use ListIF_P;
22with I_ListIF_P; use I_ListIF_P;
23with O_ListIF_P; use O_ListIF_P;
24
25with BSortEL_AD_00_P; use BSortEL_AD_00_P;
26
27procedure BSortIF_A_00 is
28
29  N : constant Integer := 16;
30
31  List_Count : Integer;
32
33  D_ListI : ListI(1..N);
34
35  PageHeaderI : constant String :=
36    "The sorted list of integers in ascending order are :";
37
38  procedure Bubble_SortI_A is new Bubble_SortE(Element => Integer, 
39                                               ListE   => ListI,
40                                               Compare => ">=");
41  D_ListF : ListF(1..N);
42
43  PageHeaderF : constant String :=
44    "The sorted list of floats in ascending order are :";
45
46  procedure Bubble_SortF_A is new Bubble_SortE(Element => Float, 
47                                               ListE   => ListF,
48                                               Compare => ">=");
49begin
50
51  GetIL(List_Count, D_ListI);
52  Bubble_SortI_A(List_Count, D_ListI);
53  PutIL(List_Count, D_ListI, PageHeaderI);
54  	
55  GetFL(List_Count, D_ListF);
56  Bubble_SortF_A(List_Count, D_ListF);
57  PutFL(List_Count, D_ListF, PageHeaderF);
58
59end BSortIF_A_00;