返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y,z;
  7.     cout<<"請輸入三個整數:";
  8.     cin>>x>>y>>z;
  9.    
  10.     if(x>y && y>z)
  11.     {
  12.         cout<<x<<">"<<y<<">"<<z<<endl;
  13.     }else if(x>z && z>y)
  14.     {
  15.         cout<<x<<">"<<z<<">"<<y<<endl;
  16.     }else if(y>z && z>x)
  17.     {
  18.         cout<<y<<">"<<z<<">"<<x<<endl;
  19.     }else if(y>x && x>z)
  20.     {
  21.         cout<<y<<">"<<x<<">"<<z<<endl;
  22.     }else if(z>x && x>y)
  23.     {
  24.         cout<<z<<">"<<x<<">"<<y<<endl;
  25.     }else if(z>y && y>x)
  26.     {
  27.         cout<<z<<">"<<y<<">"<<x<<endl;
  28.     }else
  29.     {
  30.         cout<<"[其中兩個或三個數相等]"<<endl;
  31.     }
  32.     system("pause");
  33.     return 0;
  34. }
複製代碼

TOP

返回列表