Program must be in C++, Set up a pair of parallel arrays of values with decimals
ID: 3678393 • Letter: P
Question
Program must be in C++,
Set up a pair of parallel arrays of values with decimals.
Implement any of the sorting algorithms from class. Specifically tell which algorithm you are implementing in your header comments.
In doing your sort, sort according to the values in one of the arrays, but be careful to move both data points in each pair while sorting. See the example below.
Print out the data in both arrays both before and after sorting. In doing so...
Put each array in a column of width 10, where values are right-aligned.
Display each value with exactly one decimal place.
Sample Starting Arrays:
Here is code to set up those arrays that you may copy and paste to save time:
Sample Arrays, Sorted by x:
Sample Arrays, Sorted by x and with Output Decimals as Directed:
x y 33.35 1 26 3.2 20.1 2.1 28.123 4.3 12 5.4Explanation / Answer
Hi below i have written the code for your reference, #include #include #include #include #include static struct Verify { int D; double B; Verify(int d, double b) : D(d), B(b) {} bool operatorRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.