Write a C++ program that allows the user to enter double values. Display one of two messages: "The first number you entered is larger", "The second number you entered is larger". Save file as LargerorNot.cpp

Respuesta :

Answer:

Following are the program in c++

#include <iostream> // header file

using namespace std; // namespace

int main() // main function

{

double a,b; // variable declaration

cout<<"Enter the first number and second number : \n";

cin>>a>>b; // input the number

if(a>b) // check first number greater than second number

{

cout<<"The first number you entered is larger";

}

else

{

cout<<"The second number you entered is larger";

}

return 0;

}

Output:

Enter the first number and second number :

45.5

687.8

The second number you entered is larger

Explanation:

In this program we have declared two variable i.e a and b of double type. After that check the condition if(a>b) if this condition is true then display  the message "The first number you entered is larger " otherwise display the message  "The second number you entered is larger".