-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogmain.adb
81 lines (55 loc) · 1.24 KB
/
progmain.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
with Text_IO;
with Sort;
procedure ProgMain is
use Text_IO;
use Sort;
package int_io is new Integer_IO(Integer);
use int_io;
MyArray: yourNumbers;
ArrayTotal: Integer := 0;
--declare array to be operated on
task Reader is
entry GetNow;
end Reader;
task Sum is
entry SumNow;
end Sum;
task Printer is
entry PrintNow;
end Printer;
task body Reader is
begin
accept GetNow do
for ArrayIndex in 1..SIZE loop
get(MyArray(ArrayIndex));
end loop;
end GetNow;
end Reader;
task body Printer is
begin
accept PrintNow do
Sum.SumNow;
for ArrayIndex in 1..SIZE loop
New_Line;
put(MyArray(ArrayIndex));
end loop;
-- Sum.SumNow;
end PrintNow;
end Printer;
task body Sum is
begin
accept SumNow do
for ArrayIndex in 1..SIZE loop
ArrayTotal := ArrayTotal + MyArray(ArrayIndex);
put(ArrayTotal); --delete this after demo
end loop;
New_Line;
put("This is the Sum: ");
put(ArrayTotal);
end SumNow;
end Sum;
begin
Reader.GetNow;
MergeSort(MyArray,1,SIZE);
Printer.PrintNow;
end ProgMain;