Yurttas/PL/IL/Ada-95/F/03/02/01/buffer queue 01.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-- date   : January 1, 1998.
12-- author : Salih Yurttas.
13
14-- purpose : buffered solution of queues.
15
16-- buffer_queue_01.adb
17
18
19with Ada.Text_IO;
20use Ada.Text_IO;
21
22with Buffer_Queue_P;
23
24procedure Buffer_Queue_01 is
25
26  package Int_IO is new Integer_IO(Integer);
27  use Int_IO;
28
29  package B_Queue is new Buffer_Queue_P(Items=> Integer);
30  use B_Queue;
31
32  Item : Integer;
33
34begin
35
36  Buffer_Queue.Remove(Item);
37
38  Put(Item);
39  New_Line(2);
40
41  Put("--> Item : ");
42  Get(Item);
43  Skip_Line;
44
45  Buffer_Queue.Insert(Item);
46
47  New_Line;
48  Put("--> Item : ");
49  Get(Item);
50  Skip_Line;
51
52  Buffer_Queue.Insert(Item);
53
54  Buffer_Queue.Remove(Item);
55
56  Put(Item);
57  New_Line(2);
58
59  New_Line;
60  Put("--> Item : ");
61  Get(Item);
62  Skip_Line;
63
64  Buffer_Queue.Insert(Item);
65
66  Buffer_Queue.Remove(Item);
67
68  Put(Item);
69  New_Line(2);
70
71end Buffer_Queue_01;