输入三个实数,按从大到小的顺序输出。
#include<iostream>
using namespace std;
int main(){
double x, y, z;
cout << "x,y,z=";
cin >> x >> y >> z;
if (x > y && x > z) {
cout << x;
if (y > z)cout << y << z;
else cout << z << y;
}
if (y > x && y > z) {
cout << y;
if (x > z)cout << x << z;
else cout << z << x;
}
if (z > x && z > y) {
cout << z;
if (y > x)cout << y << x;
else cout << x << y;
}
return 0;
}
运用分支结构来判断实数大小