/* File: main.c This program uses the functions provided by our random number library. */ #include #include "genlib.h" #include "simpio.h" /* Include the random number header file */ #include "random.h" main() { int i, j, go_ahead ; int r1, r2 ; SetRandomRange(1,6) ; while (TRUE) { printf("\nEnter 1 to continue: ") ; go_ahead = GetInteger() ; if (go_ahead != 1) break ; SetRandomSeed() ; /* Print out 50 random numbers in a 10 x 5 grid */ printf("Sum of two dice between 1 and 6\n") ; for (i = 0 ; i < 10 ; i++) { for (j = 0 ; j < 5 ; j++) { r1 = GetRandomNumber() ; r2 = GetRandomNumber() ; printf("%8d ", r1 + r2 ) ; } printf("\n") ; } } }