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

  12.    if(x>y&&y>z)
  13.       {
  14.             cout<<z<<"<"<<y<<"<"<<x<<endl;
  15.       }
  16.    else if(x>z&&z>y)
  17.       {
  18.             cout<<z<<"<"<<y<<"<"<<x<<endl;
  19.       }
  20.    else if(z>x&&x>y)
  21.       {
  22.              cout<<y<<"<"<<x<<"<"<<z<<endl;
  23.       }
  24.    else if(z>y&&y>x)
  25.       {
  26.              cout<<x<<"<"<<y<<"<"<<z<<endl;
  27.       }  
  28.    else if(y>x&&x>z)
  29.       {
  30.              cout<<z<<"<"<<x<<"<"<<y<<endl;
  31.       }  
  32.    else if(y>z&&z>x)
  33.       {
  34.              cout<<x<<"<"<<z<<"<"<<y<<endl;
  35.       }     
  36.    system("pause");
  37.    return 0;   
  38. }
複製代碼

TOP

返回列表