Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Programming questions