Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// 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

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions