- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- 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>z&&z>x)
- {
- cout<<y<<">"<<z<<">"<<x;
- }
- else if(y>x&&x>z)
- {
- cout<<y<<">"<<x<<">"<<z;
- }
- else if(z>x&&x>y)
- {
- cout<<z<<">"<<x<<">"<<y;
- }
- else if(z>y&&y>x)
- {
- cout<<z<<">"<<y<<">"<<x;
- }
- else
- {
- cout<<"其中兩個數, 或三個數相等!"<<endl;
- }
-
- }
- system("pause");
- return 0;
-
- }
複製代碼 |