Question
I have a C++ program which I could use help on, much appreciated, thank you! Write a complete program to do the following: The main
I have a C++ program which I could use help on, much appreciated, thank you!
Write a complete program to do the following:
The main program calls a function to read in a set of peoples three-digit ID numbers and their donations to a charity. The main program calls a function to sort the ID numbers into numerical order, being sure to carry along the corresponding donations.
The main program calls a function to print the sorted lists, giving both ID numbers and donations. The main program also calls a function to sort the donation amounts into ascending order, carrying along the corresponding ID numbers. Print the sorted lists, giving both ID numbers and donations.
Here are the details:
(a) The main program calls a function to read in the data. The data set consists of a parameter value which the main program calls n and n groups of data, each of which contains a persons three-digit ID number and an integer (ie: 456 20000 or 123 30234).
(b) Then the main program sends the array of ID numbers, the array of donations, and the size n to a sorting function. This function sorts the ID numbers into numerical order. Be sure to maintain the matchup of ID numbers and donations. For example, 456 should always be associated with 20000, no matter where 456 moves in numerical order; similarly, 123 should stay with 30234.
When the sorting function finishes and returns control to the main program, it calls the printing function to print the two arrays.
(c) Next the main program sends the same three parameters to the sorting function, which sorts the donations into numerical order, being sure to maintain the linkup of ID numbers and donations.
When the sorting function finishes and returns control to the main program, it calls the printing function to print the two arrays with appropriate headings.
Your arrays should have room for up to 50 entries. To test the program, have a set of data with at least 15 to 20 values in each array. Make sure that your original order in not close to numerical order for either array and that the two numerical orders are not close to each other.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started