返回列表 發帖
本帖最後由 曾宥程 於 2019-7-20 10:40 編輯
  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.             cout<<x<<">"<<y<<">"<<z<<endl;
  12.         else if(x>z && z>y)
  13.             cout<<x<<">"<<z<<">"<<y<<endl;
  14.         else if(y>x && x>z)
  15.             cout<<y<<">"<<x<<">"<<z<<endl;
  16.         else if(y>z && z>x)
  17.             cout<<y<<">"<<z<<">"<<x<<endl;
  18.         else if(z>x && x>y)
  19.             cout<<z<<">"<<x<<">"<<y<<endl;
  20.         else if(z>y && y>x)
  21.             cout<<z<<">"<<y<<">"<<x<<endl;
  22.         else
  23.             cout<<"其中兩個數, 或三個數相等!"<<endl;
  24.         goto re;      
  25.     system("pause");
  26.     return 0;
  27. }
複製代碼

TOP

返回列表