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

TOP

返回列表