Question
Write a program to read from a binary data file (Lab4.dat). Sort the data in ascending order (smallest to largest). Find the minimum value, maximum
Write a program to read from a binary data file (Lab4.dat). Sort the data in ascending order (smallest to largest). Find the minimum value, maximum value, median value, mean, and standard deviation of the data set. Lab4.dat is a binary data file that contains 200 doubles in random order, valued in the range (-1.0, 1.0). So I expect the mean pretty close to zero. The min should be element zeroth, the max element 199th, and the median element 99th. See Fig 7.2, page 384-385 in the text for how to set up your for loop to computer the mean (average) and standard deviation. You have to modify the swap and sort functions to take in doubles instead of integers. Once you have the array sorted, print them out to the console, 10 elements per row. So I expect to see 20 rows of data - sorted, see attached bitmap file for how to print your sorted data. Hint: use this format string if you want your data to look like mine: printf("% 02.4f ", bin_arr[i]); After printing your sorted data, also print the min, max, median, mean, and standard deviation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started