返回列表 發帖
本帖最後由 蔡昀佑 於 2011-11-5 16:32 編輯
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int x, s,t;
  6. cout<<"請輸入第一個數"<<endl;
  7. cin>>x;
  8. cout<<"請輸入第二個數"<<endl;
  9. cin>>s;
  10. cout<<"請輸入第三個數"<<endl;
  11. cin>>t;

  12.    if(x<s&&x<t)
  13.      {
  14.           if(s<t)
  15.          {
  16.             cout<<x<<"<"<<s<<"<"<<t;  
  17.               
  18.         }else
  19.         {
  20.            cout<<x<<"<"<<t<<"<"<<s;   
  21.         }
  22.     }
  23.    
  24.    if(s<x&&s<t)
  25.    {
  26.       if(x<t)         
  27.        {
  28.           cout<<s<<"<"<<x<<"<"<<t;
  29.        } else
  30.        {
  31.           cout<<s<<"<"<<t<<"<"<<x;   
  32.        }
  33.    }
  34.   if(t<s&&t<x)
  35.   {
  36.     if(x<s)
  37.     {
  38.     cout<<t<<"<"<<x<<"<"<<s;      
  39.     }  else
  40.     {
  41.     cout<<t<<"<"<<s<<"<"<<x;      
  42.     }                     
  43.   }   
  44.    system("pause");
  45.    return 0;   
  46. }
複製代碼

TOP

返回列表