Skip to content

Instantly share code, notes, and snippets.

@wzhd
Created February 19, 2015 06:21
Show Gist options
  • Save wzhd/814de13caf7ebc50acd7 to your computer and use it in GitHub Desktop.
Save wzhd/814de13caf7ebc50acd7 to your computer and use it in GitHub Desktop.
#include <iostream>
bool order(int &a, int &b, int &c) {
if (a < b && b < c)
return true;
else {
if (a > b) {
std::swap(a, b);
}
if (b > c) {
std::swap(b, c);
}
if (a > b) {
std::swap(a, b);
}
return false;
}
}
int main() {
int x,y,z;
std::cin>>x>>y>>z;
if (!order(x,y,z))
std::cout<<x<<' '<<y<<' '<<z;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment