Good day guys, I'm a beginner of c++ programming, and suffering from a petty problem.
This code is to set typed values upperbound.
#include "../../std_lib_facilities.h"
int change(int a, int b) {
if (a > b) {
int c = a; a = b; b = c;
}
return a, b;
}
int main() {
int a, b, c;
while (cout << "Type 3 numbers: \n" && cin >> a >> b >> c) {
a,b = change(a, b);
b,c = change(b, c);
a,b = change(a, b);
cout << a << ", " << b << ", " << c << "\n";
}
simple_error("You typed invalid number.\n");
}
In this case, for instance, when I type '2 5 3' it returns '2, 5, 5' not '2, 3, 5' as expected. I found that
b,c = change(b, c);
this line has problem debugging by cout, but I don't know the reason. How could I solve it? Thanks for reading.