Q: Write a proogram that asks the user to enter 2 numbers. The program should use the CONDITIONAL OPERATOR to determine which number is the smaller and which is the larger.
I need the solution. Please help. I used this, which worked, but lost when it comes to CONDITIONAL OPERATOR.....
// Conditional Operator not used.
if (num1 > num2)
cout << num1 << " is the larger number" << endl;
else if (num2 > num1)
cout << num2 << " is the larger number" << endl;
Your solution is exactly right and uses the conditional operator >, although you didn't print the smaller number. You could add a second print to each if statement to do that.