Question: The file data.txt contains 1000 unsorted floating-point numbers. Write a program to sort them into the ascending order (from small to large), and write the

The file data.txt contains 1000 unsorted floating-point numbers. Write a program to sort them into the ascending order (from small to large), and write the sorted numbers into a file named result.txt. Hint: You may use the bubble sort function presented in the slides Slides_Week_6b_Fall_2017_10052017.pdf. The function presented in the slides takes an integer array as argument. We need to modify it for a floating-point array.

28.86 -24.28 62.32 6.57 -29.85 87.80 75.19 10.03 24.50 17.41 -58.45 -39.75 -5.82 -53.90 68.86 -61.05 -54.82 -65.86 -54.47 -12.86 -37.78 84.68 -13.96 -63.04 80.98 95.95 -12.23 -77.78 -48.39 -18.26 18.98 -47.56 20.57 42.24 -55.65 -76.52 -40.66 -36.24 -15.17 1.57 -82.90 -47.50 60.20 -94.16 85.77 46.07 -2.28 15.71

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!