- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- { re:
- int x,y,z;
- cout<<"請輸入任意三個數:";
- cin>>x>>y>>z;
- if(x>y && y>z)
- {
- cout<<x<<">"<<y<<">"<<z;
- }else if(x>z && z>y)
- {
- cout<<x<<">"<<z<<">"<<y;
- }else if(y>x && x>z)
- {
- cout<<y<<">"<<x<<">"<<z;
- }else if(y>z && z>x)
- {
- cout<<y<<">"<<z<<">"<<x;
- }else if(z>x && x>y)
- {
- cout<<z<<">"<<x<<">"<<y;
- }else if(z>y && y>x)
- {
- cout<<z<<">"<<y<<">"<<x;
- }else
- {
- cout<<"其中兩個數, 或三個數相等!";
- }
- goto re;
-
- system("pause");
- return 0;
- }
複製代碼 |