返回列表 發帖
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    int x,y,z;
  6.     cout<<"請輸入三個數字電腦會幫您排列數字的大小"<<endl;
  7.       cin>>x>>y>>z;
  8.    cout<<"你輸入的數字是"<<x<<" "<<y<<" "<<z<<endl;
  9.    if(x<y&&y<z)
  10.       {
  11.             cout<<x<<"<"<<y<<"<"<<z<<endl;
  12.       }
  13.    else if(x<z && z<y)
  14.       {
  15.             cout<<x<<"<"<<z<<"<"<<y<<endl;
  16.       }
  17.       else if(z<x && x<y)
  18.       {
  19.              cout<<z<<"<"<<x<<"<"<<y<<endl;
  20.       }
  21.    else if(z<y && y<x)
  22.       {
  23.              cout<<z<<"<"<<y<<"<"<<x<<endl;
  24.       }  
  25.    else if(y<x && x<z)
  26.       {
  27.              cout<<y<<"<"<<x<<"<"<<z<<endl;
  28.       }  
  29.    else if(y<z && z<x)
  30.       {
  31.              cout<<y<<"<"<<z<<"<"<<x<<endl;
  32.       }   
  33.           system("pause");
  34.    return 0;   
  35. }
複製代碼

TOP

返回列表