Lab 8 Lab8-input.txt 0.076 10.886 5·648 12.023 12.224 6.882 0.226 0.039 16.193 4.916 3.978 17.877 -6.045 8.966 10.351 0.437 4.157 9.658 -9.480 3.049 9.223 27.855 4.669 3.873 CMPSC 201-Spring 2019 Lab 8 To be done individuallv Due by end of your recitation section on 3/29/19. Goals: Practicing 1-dimensional arrays in functions. Problem: Download the file "arrayfunctiondemo.cpp" from lecture on Wednesday 3/20 and modify the code so it will use a function to input data from a file, output data to the screen, and to sort the data in ascending order. Your modifications should include: revising the introductory comments, increasing the value of the global constant so the array could hold up to 75 values, e . rewriting the function to store values in the array so that the values come from a file rather than interactive input (the filename may be entered in the function or passed to the function), adding a new function that will sort the array ascending (low to high) using one of the algorithms given in class on Monday 3/25 (the code is posted on Canvas), and modifying the main function so that it calls the function to input the values in the array, then calls the function to print the unsorted array, then calls the function to sort the array ascending, and finally calls the function to print the array again with the sorted array e . For example, if the file contains the values 3.56, 12.89, 9.25, 10.67,-4.67, 8.11, 14.678, 7.234 23.9,-8.92, 15.24, 2.25 then the output from your code should look like the following: There were 12 values in the file. The original data in the file was: 12.89 14.678 3.56 8.11 15.24 10.67 23.9 -4.67 -8.92 9.25 7.234 2.25 The sorted data is: -8.92 8.11 15.24 -4.67 9.25 23.9 2.25 10.67 3.56 12.89 7.234 14.678 Use the data file "Lab8-input.txt., posted on Canvas to test your code. Make sure that your code follows the Assignment Guidelines posted on Canvas. Do not use any concepts beyond Chapter 8 in your textbook. Submit yourC++ file to the Assignment on CANVAS. Remember to confirm all your submissions to CANVAS Lab 8 Lab8-input.txt 0.076 10.886 5·648 12.023 12.224 6.882 0.226 0.039 16.193 4.916 3.978 17.877 -6.045 8.966 10.351 0.437 4.157 9.658 -9.480 3.049 9.223 27.855 4.669 3.873 CMPSC 201-Spring 2019 Lab 8 To be done individuallv Due by end of your recitation section on 3/29/19. Goals: Practicing 1-dimensional arrays in functions. Problem: Download the file "arrayfunctiondemo.cpp" from lecture on Wednesday 3/20 and modify the code so it will use a function to input data from a file, output data to the screen, and to sort the data in ascending order. Your modifications should include: revising the introductory comments, increasing the value of the global constant so the array could hold up to 75 values, e . rewriting the function to store values in the array so that the values come from a file rather than interactive input (the filename may be entered in the function or passed to the function), adding a new function that will sort the array ascending (low to high) using one of the algorithms given in class on Monday 3/25 (the code is posted on Canvas), and modifying the main function so that it calls the function to input the values in the array, then calls the function to print the unsorted array, then calls the function to sort the array ascending, and finally calls the function to print the array again with the sorted array e . For example, if the file contains the values 3.56, 12.89, 9.25, 10.67,-4.67, 8.11, 14.678, 7.234 23.9,-8.92, 15.24, 2.25 then the output from your code should look like the following: There were 12 values in the file. The original data in the file was: 12.89 14.678 3.56 8.11 15.24 10.67 23.9 -4.67 -8.92 9.25 7.234 2.25 The sorted data is: -8.92 8.11 15.24 -4.67 9.25 23.9 2.25 10.67 3.56 12.89 7.234 14.678 Use the data file "Lab8-input.txt., posted on Canvas to test your code. Make sure that your code follows the Assignment Guidelines posted on Canvas. Do not use any concepts beyond Chapter 8 in your textbook. Submit yourC++ file to the Assignment on CANVAS. Remember to confirm all your submissions to CANVAS
-
Engineering 2022-05-15 19:04:59