Question: CSCI-40--ENGR-40 ASSIGNMENT No. 19b Program 19b SORTING ARRAYS Consider the following code. The file check.txt has two columns of ten numbers each. The first column

 CSCI-40--ENGR-40 ASSIGNMENT No. 19b Program 19b SORTING ARRAYS Consider the following

CSCI-40--ENGR-40 ASSIGNMENT No. 19b Program 19b SORTING ARRAYS Consider the following code. The file check.txt has two columns of ten numbers each. The first column contains four-digit integers that are check numbers, the second column contains floating-point numbers that are the amounts in dollars that correspond to each check number. int main( ) { int check_number[10], k, n=10; double check_amount[10]; . void check_sort(int num[ ], double amt[ |, int n); //function prototype ifstream in; in.open(\"e:\\\\check.txt\"); for (k=0; k>check_number[k]>>check_amount[k]; check_sort(check number, check_amount. n); return (0 J The purpose of the function check_sort is to sort the check_number and check amount arrays by check number. The integer n that was passed along with the arrays tells the function the number of valid elements in cach array. The check_number array should be converted to ascending order and the check_amount array should be sorted in parallel with the check_number array so the amounts still correspond to their original check number. Write the check sort function. Hint: utilize/modify the sort function from Chapter 8.3 so that both arrays are sorted simultaneously

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 Programming Questions!