返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a,b,c;
  7.     cout<<"請輸入三個數字:";
  8.     cin>>a>>b>>c;
  9.     int x=0;
  10.     if(a>b)
  11.     {
  12.            x =a;
  13.     }else
  14.     {
  15.          x =b;
  16.     }
  17.     if(x>c)
  18.     {
  19.            cout<<"三數中最大的數為:"<<x<<endl;
  20.     }else
  21.     {
  22.          cout<<"三數中最大的數為:"<<c<<endl;
  23.     }
  24.     system("pause");
  25.     return 0;
  26.     }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a,b,c;
  7.     cin>>a>>b>>c;
  8.     int x;
  9.     x = (a>b) ? a:b;
  10.     x = (x>c) ? x:c;
  11.     cout<<x<<endl;
  12.    
  13.     system ("pause");
  14.     return 0;
  15. }
複製代碼

TOP

返回列表