Question: // Modify this program below to work with 4 inputs: num1, num2, num3, and num4 // You are free to use any form of chained

// Modify this program below to work with 4 inputs: num1, num2, num3, and num4 // You are free to use any form of chained or nested if-else statements/blocks // You are free to use any logical operators to test for complex conditions // You are free to use switch statements (haven't discussed in class yet; so this is optional) // You can assume the 4 input numbers are all distinct. // Do not use any kind of loops or user-defined functions. // Do not import any other libraries (besides iostream). // Do not use any advanced data structures (such as arrays). // SUGGESTION: start with modifying to work with 3 inputs.
#include using namespace std; int main() { int num1, num2; // take in all the inputs cout << "Enter the first number: "; cin >> num1; cout << "Enter the second number: "; cin >> num2; // display the inputs in descending order cout << "The entered numbers in descending order are: "; if( num1 > num2 ) { cout << num1 << ", " << num2 ; } else { cout << num2 << ", " << num1 ; } cout << endl; return 0; }

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