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

TOP

返回列表