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

TOP

返回列表