Created
June 9, 2017 04:39
-
-
Save Flaze07/d3f094aafe53aa2cbd188a042f94b1fc to your computer and use it in GitHub Desktop.
This file contains 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> | |
int main() | |
{ | |
enum class Condition {bigger, smaller, equal}; | |
int input1; | |
int input2; | |
Condition condition; | |
std::cout << "enter first number\n"; | |
std::cin >> input1; | |
std::cout << "enter second number\n"; | |
std::cin >> input2; | |
if (input1 > input2) | |
{ | |
condition = Condition::bigger; | |
} | |
else if (input1 < input2) | |
{ | |
condition = Condition::smaller; | |
} | |
else if (input1 == input2) | |
{ | |
condition = Condition::equal; | |
} | |
if (condition == Condition::bigger) | |
{ | |
std::cout << "first number is bigger\n"; | |
} | |
else if (condition == Condition::smaller) | |
{ | |
std::cout << "first number is smaller\n"; | |
} | |
else if (condition == Condition::equal) | |
{ | |
std::cout << "both numbers are equal\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this code contains overhead but this is just to teach my friend about enum...specifically enum class