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

TOP

返回列表