EG H167 1:30 Sec. Winter 2001 Daily Assignment D12Advanced
For the D12 Advanced assignment:
1. Complete the regular D12 assignment which introduces use of pointers in C and sorting. In addition to displaying the results on the screen, write the sorted results to a file, d12res.dat.
2. Now that you have the array of wrist pins sorted, it is fairly straightforward to do some further statistical analysis and simple display. Complete the following as additions to your program in Step 1 above:
a). Calculate the median diameter of all 20 wrist pins. Print this value on the d12res.dat file with 4 digits to the right of the decimal point. Note that by usual definition, the median is located at middle of the sorted array, say at element pindiam [SIZE/2]. But this is true only when the array size is odd; when the array size is even, the median should be calculated as the mean of the two middle elements of the array.
b). Calculate the mode of the set of wrist pins. The mode is that diameter which occurs most frequently in the set of wrist pins. Print to the d12res.dat file the mode and the count of the number of times that diameter occurred. Optionally, print a histogram of the results of the modal analysis to aid in determining the mode "graphically". For example, something like:
Wrist Pin Frequency
Diameter 1 2 3 4 5 6 7 8 9 10