Statistics and Histograms Download

Dave Wittry

ints, basic math, strings, printing Student approved


Introduction

  1. You'll receive a text file, numbers.txt, that contains many integers ranging in value from 0 to 100. The text file has been created with each value separated by at least one space.
  2. The number of integers in the file is unknown. You must read the text file until it ends.


Task

Print a histogram of the frequency counts of the numbers in the numbers.txt file.

Since the range of numbers is [0,100] you’ll need to break up the lines as shown above (0...25, 26...50, 51...75, 76...100). There should only be one blank line between any row of numbers and the highest star in the row under the numbers.


Expected output

							*
					 *		 	*				
	*			 		*	 	* * *
	*	 *	 	*	 *	 * 						
00 01 02 03 04 05 06 07 08 09 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…75

 *
 *
 *   *
76..100

Useful tools to solve the problem