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