- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main (){
- int x ,y, z;
- re:
- cout<<"請依序輸入三數";
- cin>>x;
- cin>>y;
- cin>>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 if(x==y&&x>z)
- cout<<x<<"="<<x<<">"<<z<<endl;
- else if(x==y&&y<z)
- cout<<z<<">"<<x<<"="<<x<<endl;
- else if(x==z&&z<y)
- cout<<y<<">"<<z<<"="<<z<<endl;
- else if(x==z&&z>y)
- cout<<z<<"="<<z<<">"<<y<<endl;
- else if(y==z&&z>x)
- cout<<z<<"="<<z<<">"<<x<<endl;
- else if(y==z&&z<x)
- cout<<x<<">"<<z<<"="<<z<<endl;
- else if(x==y&&y==z)
- cout<<z<<"="<<z<<"="<<z<<endl;
- else
- cout<<"輸入錯誤"<<endl;
- cout<<endl;
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |