Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program works if the numbers are different, but not if they are the same, b

ID: 3635906 • Letter: T

Question

This program works if the numbers are different, but not if they are the same, but the company wants the user to be able to input three number and put them in order. What do I have to do to make that modification?!?!

#include <iostream.h>
void main()
{
int i ;
int j ;
cout << "Enter the first integer: " << endl ;
cin >> i ;
cout << "Enter the second integer: " << endl ;
cin >> j ;
if( i == j )
cout << "The numbers are equal." << endl ;
if( i < j )
cout << i << " is less than " << j << endl ;
else
cout << j << " is less than " << i << endl ;
}

Explanation / Answer

You missed an "else" - so for equal numbers, your program would be printing 2 lines The numbers are equal ___ is less than ____ Here's the corrected version. #include void main() { int i ; int j ; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote