本帖最後由 t3742238 於 2011-11-5 16:11 編輯
- #include <iostream>
- using namespace std;
- int main()
- {
- int x, y,z;
- cout<<"請輸入第一個數"<<endl;
- cin>>x;
- cout<<"請輸入第二個數"<<endl;
- cin>>y;
- cout<<"請輸入第三個數"<<endl;
- cin>>z;
- if(x>y&&y>z)
- {
- cout<<z<<"<"<<y<<"<"<<x<<endl;
- }
- else if(x>z&&z>y)
- {
- cout<<z<<"<"<<y<<"<"<<x<<endl;
- }
- else if(z>x&&x>y)
- {
- cout<<y<<"<"<<x<<"<"<<z<<endl;
- }
- else if(z>y&&y>x)
- {
- cout<<x<<"<"<<y<<"<"<<z<<endl;
- }
- else if(y>x&&x>z)
- {
- cout<<z<<"<"<<x<<"<"<<y<<endl;
- }
- else if(y>z&&z>x)
- {
- cout<<x<<"<"<<z<<"<"<<y<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |