Skip to content

Instantly share code, notes, and snippets.

@gpetuhov
Last active March 17, 2017 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpetuhov/48d9039c365ad20c68ffd4595d0eb1aa to your computer and use it in GitHub Desktop.
Save gpetuhov/48d9039c365ad20c68ffd4595d0eb1aa to your computer and use it in GitHub Desktop.
C++ Get maximum of two numbers
#include <iostream>
using namespace std;
int getMax(int x, int y)
{
if (x > y)
return x;
else
return y;
}
int main() {
int x, y = 0;
cout << "Enter X" << endl;
cin >> x;
cout << "Enter Y" << endl;
cin >> y;
cout << "MAX = " << getMax(x, y) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment