本帖最後由 曾宥程 於 2019-7-20 10:40 編輯
- #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<<endl;
- else if(x>z && z>y)
- cout<<x<<">"<<z<<">"<<y<<endl;
- else if(y>x && x>z)
- cout<<y<<">"<<x<<">"<<z<<endl;
- else if(y>z && z>x)
- cout<<y<<">"<<z<<">"<<x<<endl;
- else if(z>x && x>y)
- cout<<z<<">"<<x<<">"<<y<<endl;
- else if(z>y && y>x)
- cout<<z<<">"<<y<<">"<<x<<endl;
- else
- cout<<"其中兩個數, 或三個數相等!"<<endl;
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |