Created
October 17, 2017 18:00
-
-
Save JohnPhamous/38efe3d9b41f97c49e9db42fd8ca7335 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| // Rules: | |
| // User will enter in 4 numbers: a, b, c, d | |
| // a > b, b < c, c = d | |
| int main() { | |
| int num1, | |
| num2, | |
| num3, | |
| num4; | |
| bool success = false; | |
| while (!success) { | |
| cout << "Enter 4 numbers." << endl; | |
| cout << "(1): "; | |
| cin >> num1; | |
| cout << "(2): "; | |
| cin >> num2; | |
| cout << "(3): "; | |
| cin >> num3; | |
| cout << "(4): "; | |
| cin >> num4; | |
| if (num1 > num2) { | |
| cout << "The first number looks good!" << endl; | |
| success = true; | |
| } | |
| else { | |
| cout << "The first number needs some fixing..." << endl; | |
| success = false; | |
| } | |
| if (num2 < num3) { | |
| cout << "The second number looks good!" << endl; | |
| success = true; | |
| } | |
| else { | |
| cout << "The second number needs some fixing..." << endl; | |
| success = false; | |
| } | |
| if (num3 == num4) { | |
| cout << "The third number looks good!" << endl; | |
| success = true; | |
| } | |
| else { | |
| cout << "The third number needs some fixing..." << endl; | |
| success = false; | |
| } | |
| if (num4 == num3) { | |
| cout << "The fourth number looks good!" << endl; | |
| success = true; | |
| } | |
| else { | |
| cout << "The fourth number needs some fixing..." << endl; | |
| success = false; | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment