Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main ()
- {
- //Initialize the two integers that we'll be testing against.
- int firstNumber;
- int secondNumber;
- //Prompt for the first integer to accept and store.
- cout << "Please enter the first number: ";
- cin >> firstNumber;
- //Prompt for the second integer to accept and store.
- cout << "Please enter the second number: ";
- cin >> secondNumber;
- //Test to see if both numbers are greater than 10.
- //If they are we print that to screen and then stop.
- if ( firstNumber > 10 && secondNumber > 10)
- cout << "The numbers" << firstNumber << " and " << secondNumber << " are both over 10";
- //If both numbers are not greater than 10 we test to
- //see if they are less than 10. If they are we out put that.
- else if (firstNumber <= 10 && secondNumber <= 10)
- cout << "The numbers " << firstNumber << " and " << secondNumber << " are both under 10";
- //We check to see if both numbers are equal to 10 exactly. If is we send that
- //to screen.
- else if (firstNumber == 10 && secondNumber == 10)
- cout << "Both numbers are equal to 10!.";
- //If nothing matches we send out what their relation is to the number 10.
- else
- {
- if (firstNumber > 10)
- cout << "The first number, " << firstNumber << " is above 10.\n";
- else if (firstNumber < 10)
- cout << "The first number, " << firstNumber << " is below 10.\n";
- if (secondNumber > 10)
- cout << "The second number, " << secondNumber << " is above 10.\n";
- else if (secondNumber < 10)
- cout << "The second number, " << secondNumber << " is below 10.\n";
- }
- //Return the exit code of 0.
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment