Skip to content

Instantly share code, notes, and snippets.

@yvan-sraka
Created April 25, 2017 12:06
Show Gist options
  • Save yvan-sraka/217bf8b7d95b2b5c1385ee24bf232d03 to your computer and use it in GitHub Desktop.
Save yvan-sraka/217bf8b7d95b2b5c1385ee24bf232d03 to your computer and use it in GitHub Desktop.
#include <iostream>
// ALGORITHME
int max2(int a, int b) {
if (a > b) {
return a;
} else {
return b;
}
}
// TESTS
int main() {
std::cout << max2(2, 5) << std::endl;
std::cout << max2(-2, -5) << std::endl;
// std::cout << max2(2.1, 2.5) << std::endl; // ERROR
// std::cout << max2("bar", "foo") << std::endl; // ERROR
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment