Write a program that reads four floating point values w,x,y,z and changes the values in the variables so that w now contains the maximum value, x now contains the next largest value, y contains the next largest value and z contains the minimum value. So, the problem is to sort the values in the 4 variables from largest to smallest. A quick Google search will find you lots of sorting algorithms - usually we store the values to be sorted in an array and sorting algorithms are designed to work for any size array. But the purpose of this exercise is for you to think independently about how to carry out such an operation and to implement your algorithm just for the case of 4 variables, given as above. It is an exercise in (a) using if statements and (b) recognising the difficulty in carrying out such an operation without the use of arrays. So, complete the exercise, as stated without using an array. Use the preloaded template below. Do not change the input or output statements. For example: Input Result 3 6 5 8 8.0 6.0 5.0 3.0 54.0 12.0 12.0 32.0 54.0 32.0 12.0 12.0
Write a program that reads four floating point values w,x,y,z and changes the values in the variables so that w now contains the maximum value, x now contains the next largest value, y contains the next largest value and z contains the minimum value. So, the problem is to sort the values in the 4 variables from largest to smallest. A quick Google search will find you lots of sorting algorithms - usually we store the values to be sorted in an array and sorting algorithms are designed to work for any size array. But the purpose of this exercise is for you to think independently about how to carry out such an operation and to implement your algorithm just for the case of 4 variables, given as above. It is an exercise in (a) using if statements and (b) recognising the difficulty in carrying out such an operation without the use of arrays. So, complete the exercise, as stated without using an array. Use the preloaded template below. Do not change the input or output statements. For example: Input Result 3 6 5 8 8.0 6.0 5.0 3.0 54.0 12.0 12.0 32.0 54.0 32.0 12.0 12.0
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 11PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning