Chapter 10 Exercise Set 0: Chapter ReviewΒΆ
Rerun the
how_manyexperiment from the Counting section with larger values fornum_valuesand describe your results. Try callingsrandseeded with the current time. Repeat this several times, documenting your results.Encapsulate the single pass histogram from the A histogram section in a function named
histogramthat takes a vector and a range of values in the vector (which was 0 through 9 in the example), and returns a histogram of the values in the vector.Open a file named
random_numbers.datcontaining several lines of random integers seperated by spaces, and read them into a vector namednumbers. Then use the insertion sort algorithm presented in the Other member functions section to sort these numbers. Finally, open a file namedsorted_numbers.datfor writing, and write out your sorted list of numbers to this file.