1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | procedure main:
declare values as a dynamic array of float
declare value_count := 0
if process_number = 0 then
declare value := 0
while can_read(stdin) do
append(values, value)
end while
value_count := count(values)
end if
// Send a variable or array from the source process to the rest
broadcast(&value_count, 1, 0)
resize(values, value_count)
broadcast(&values, count(values), 0)
for index := 0 to count(values) do
print(process_number, ": ", index, ": ", values[index])
end for
end procedure
|