#include <iostream>
using namespace std;
int main( ) {
int x, y, z, ft, sd, th;
while ( true ) {
cout << "Digite 3 valores reais e diferentes: \n " ;
cin >> x;
cin >> y;
cin >> z;
if ( z == y || x == z || x == y) {
cout << "\n Erro. Os valores devem ser diferentes de 0 e nao repetidos. Tente novamente: \n " << endl;
continue ;
}
break ;
}
if ( x > y && x > z) {
ft = x;
} else if ( x > y && x < z) {
sd = x;
} else if ( x > z && x < y) {
sd = x;
} else if ( x < y && x < z) {
th = x;
}
if ( y > x && y > z) {
ft = y;
} else if ( y < x && y > z) {
sd = y;
} else if ( y < z && y > x) {
sd = y;
} else if ( y < x && y < z) {
th = y;
}
if ( z > x && z > y) {
ft = z;
} else if ( z < x && z > y) {
sd = z;
} else if ( z < y && z > x) {
sd = z;
} else if ( z < x && z < y) {
th = z;
}
cout << "\n Os valores ordenados sao: \n " << endl;
cout << "Valor mais alto: " << ft<< endl;
cout << "Valor intermediario: " << sd<< endl;
cout << "Valor mais baixo: " << th<< endl;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBpbnQgeCwgeSwgeiwgZnQsIHNkLCB0aDsKICAgIHdoaWxlKHRydWUpIHsKCSAgICBjb3V0IDw8ICJEaWdpdGUgMyB2YWxvcmVzIHJlYWlzIGUgZGlmZXJlbnRlczogXG4iOwoJICAgIGNpbiA+PiB4OwoJICAgIGNpbiA+PiB5OwoJICAgIGNpbiA+PiB6OwoKCSAgICBpZiAoeiA9PSB5IHx8IHggPT0geiB8fCB4ID09IHkpIHsKCSAgICAgICAgY291dCA8PCAiXG5FcnJvLiBPcyB2YWxvcmVzIGRldmVtIHNlciBkaWZlcmVudGVzIGRlIDAgZSBuYW8gcmVwZXRpZG9zLiBUZW50ZSBub3ZhbWVudGU6IFxuIiA8PCBlbmRsOwoJICAgICAgICBjb250aW51ZTsKCSAgICB9CgkgICAgYnJlYWs7CiAgICB9CiAgICB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