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

TOP

返回列表