Some example runs
- a simple run
- run with repeating drawing
- run with error handling
A simple run:
NOTE: in the sample ouput, the ouput lines with : are prompts
to the user, the values after the : are input values entered by
the user.
In this example, we have highlighted the user input in
bold (this is not repeated in other examples).
./prog
This program computes the average of a user specifed number of
random numbers from the range 0 to N, N specified by the user
Enter the number of random values: 400
Enter the largest value in the range: 50
The average of 400 random values in the range [0,50] is 24.095
Now I'm going to draw a pretty picture for you
enter a value betwen 3 and 20
value: 6
*
***
*****
*******
*********
***********
do you want to see another one? enter 0 for no, 1 for yes
value: 0
bye bye
An example run with repeating the drawing:
./prog
This program computes the average of a user specifed number of
random numbers from the range 0 to N, N specified by the user
Enter the number of random values: 400
Enter the largest value in the range: 50
The average of 400 random values in the range [0,50] is 25.4825
Now I'm going to draw a pretty picture for you
enter a value betwen 3 and 20
value: 4
*
***
*****
*******
do you want to see another one? enter 0 for no, 1 for yes
value: 1
enter a value betwen 3 and 20
value: 8
*
***
*****
*******
*********
***********
*************
***************
do you want to see another one? enter 0 for no, 1 for yes
value: 1
enter a value betwen 3 and 20
value: 20
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*************************
***************************
*****************************
*******************************
*********************************
***********************************
*************************************
***************************************
do you want to see another one? enter 0 for no, 1 for yes
value: 0
bye bye
An example run showing handling input that is not in range:
This program computes the average of a user specifed number of
random numbers from the range 0 to N, N specified by the user
Enter the number of random values: -4
try again, -4 isn't a positive value
Enter the number of random values: 2000
Enter the largest value in the range: -4
try again, -4 has to be larger than 0
Enter the largest value in the range: 500
The average of 2000 random values in the range [0,500] is 252.704
Now I'm going to draw a pretty picture for you
enter a value betwen 3 and 20
value: 2
Try again, 2 is not between 3 and 20
value: 22
Try again, 22 is not between 3 and 20
value: 6
*
***
*****
*******
*********
***********
do you want to see another one? enter 0 for no, 1 for yes
value: 9
Try again, 9 is not between 0 and 1
value: -3
Try again, -3 is not between 0 and 1
value: 88
Try again, 88 is not between 0 and 1
value: 1
enter a value betwen 3 and 20
value: 5
*
***
*****
*******
*********
do you want to see another one? enter 0 for no, 1 for yes
value: 0
bye bye