// Work out what the tiny function "order" is obviously trying to do // (ignore its cout's when doing that). // Make sure you undersdtand why it doesn't work. // // The way to make it work is to change the parameters to (int & a, int & b) // that makes them reference parameters. #include using namespace std; void order(int a, int b) { cout << "received " << a << ", " << b << "\n"; if (a > b) { cout << "swapping\n"; int t = a; a = b; b = t; } cout << "at end " << a << ", " << b << "\n"; } int main() { while (true) { int x, y; cin >> x >> y; order(x, y); cout << x << " " << y << "\n"; } }