Create a code in C++ that ask the user for 2 values and checks (and informs the user) if they are less than, greater than or equal to each other.
C++ code pasted below.
#include <iostream>
using namespace std;
int main()
{ float a,b;
cout<<"Enter 2 numbers:";
cin>>a>>b;
if(a>b)
cout<<"First number "<<a<<" is greater than
second number "<<b;
else if(a<b)
cout<<"First number "<<a<<" is less than second
number "<<b;
else
cout<<"First number "<<a<<" is equal to the
second number "<<b;
return 0;
}
Output Screen - Test case 1
Output Screen - Test case 2
Output Screen - Test case 3
Get Answers For Free
Most questions answered within 1 hours.