Description:
The fifth exercise simulates a lottery system.
First, create a ring just like the code in chap 7. Then, the root process waits for a signal. (sent from another shell) When the signal arrives, the root process generates a random number and writes it to the pipe.
The second process reads in the number from the pipe and writes it out to the pipe. It also generates another number and writes it out the the pipe. That is, the second process reads in one number and writes two numbers out.
The third process reads in two numbers and writes out three numbers. And so on. Finally the sixth process will write six numbers to the pipe which will be read by the root (the first) process.
And the root process just print the six numbers to stderr.
Here is the possible output

        1st shell                          |        2nd shell
-------------------------------------------+-----------------------------
$ ./a.out                                  |                      
Hello, I'm 28321. Please Send me Signals.  |   $ 
10 26 41 8 23 39                           |   $ kill -USR1 28321
2 34 17 5 37 20                            |   $ kill -USR1 28321
48 33 22 7 40 30                           |   $ kill -USR1 28321
44 28 12 45 29 13                          |   $ kill -USR1 28321
12 10 13 11 14 22                          |   $ kill -USR1 28321
36 24 13 45 34 19                          |   $ kill -USR1 28321
13 24 35 46 8 6                            |   $ kill -USR1 28321
28 1 49 6 20 46                            |   $ kill -USR1 28321
^C                                         |   $ 
$                                          |
-------------------------------------------+-----------------------------