akosiraff

Download Histogram C++ Answer

Jun 21st, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/histogram/
  3. A popular method of displaying data is in a Histogram. A histogram counts how many items of data
  4. fall in each of n equally sized intervals and displays the results as a bar chart in which each
  5. bar is proportional in length to the number of data items falling in that interval.
  6. Write a program that generates 10000 random integers in the range 0-99 and produces a Histogram
  7. from the random data. Assume that we wish to count the number of numbers that lie in each of the
  8. intervals 0-9, 10-19, 20-29, ………, 90- 99. This requires that we hold 10 counts, use an array
  9. to hold the 10 counts. While it would be possible to check which range a value x lies in by using
  10. if-else statements this would be pretty tedious. A much better way is to note that the value of
  11. x/10 returns the index of the count array element to increment.
  12. Having calculated the interval counts draw the Histogram by printing each bar of the Histogram as
  13. an appropriately sized line of X’s across the screen as below
  14. 0 – 9 16 XXXXXXXXXXXXXXXX
  15. 10 – 19 13 XXXXXXXXXXXXX
  16. 20 – 29 17 XXXXXXXXXXXXXXXXX
  17. etc.
  18. Download: https://solutionzip.com/downloads/histogram/
Add Comment
Please, Sign In to add comment