200,719 views
28 votes
28 votes
Lab 5A Problem Input two DWORD values from the keyboard. Determine which number is larger or if they are even. Your program should look like the following: First number larger Enter a number 12 Enter a number 10 12 is the larger number Press any key to close this window... Second number larger Enter a number 10 Enter a number 12 12 is the larger number Press any key to close this window... Numbers Equal Enter a number 12 Enter a number 12 Numbers are equal Press any key to close this window...

User Santrack
by
3.4k points

2 Answers

28 votes
28 votes

Final answer:

To compare two DWORD values inputted from the keyboard, you need to determine which number is larger or if they are equal.

Step-by-step explanation:

To solve this problem, you need to compare two DWORD values that are inputted from the keyboard and determine which number is larger or if they are equal. Here is an example of how the program should work:

  1. Ask the user to enter the first number.
  2. Ask the user to enter the second number.
  3. Compare the two numbers:
  • If the first number is larger, display 'The first number is larger'.
  • If the second number is larger, display 'The second number is larger'.
  • If the numbers are equal, display 'Numbers are equal'.
Close the program.

For example:

Enter a number: 12
Enter a number: 10
The first number is larger

In this case, 12 is larger than 10.

User Bruce Dou
by
3.1k points
15 votes
15 votes

Answer:

Step-by-step explanation:

#include<iostream>

using namespace std;

int main()

{

int n1,n2;

cout<<"Enter a number:"<<endl; //Entering first number

cin>>n1;

cout<<"Enter a number:"<<endl; //Entering second number

cin>>n2;

if(n1%2==0 && n1%2==0) //Checking whether the two number are even or not

{

if(n1>n2)

{

cout<<n1<<" is the larger number"<<endl;

}

else if(n1==n2)

{

cout<<"Numbers are equal"<<endl;

}

else

{

cout<<n2<<" is the larger number"<<endl;

}

}

else

{

cout<<"The number are not even"<<endl;

}

}

User RDavey
by
2.9k points