返回列表 發帖

二數中找出較大的數

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int a,b,c;
  7.    cout<<"請輸入第一個數:";
  8.    cin>>a;
  9.    cout<<"請輸入第二個數:";
  10.    cin>>b;
  11.    c=(a>b)?a:b;
  12.    cout<<"兩數中較大的數為"<<c<<endl;
  13.    system("pause");
  14.    return 0;
  15. }
複製代碼

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int q,w,ans;
  7.     cout<<"請輸入第一個數:"<<endl;
  8.     cin>>q;
  9.     cout<<"請輸入第二個數:"<<endl;
  10.     cin>>w;
  11.     ans=(q>=w)? q:w;
  12.     cout<<"ans"<<endl;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y,ans;
  7.     cout<<"請輸入第一個數:";
  8.     cin>>x;
  9.     cout<<"請輸入第二個數:";
  10.     cin>>y;
  11.     ans=(x>=y)?x:y;
  12.     cout<<ans<<endl;
  13.    
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int a,b,c;
  7.    cout<<"請輸入第一個數:";
  8.    cin>>a;
  9.    cout<<"請輸入第二個數:";
  10.    cin>>b;
  11.    c=(a>b)?a:b;
  12.    cout<<"兩數中較大的數為"<<c<<endl;
  13.    system("pause");
  14.    return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x, y, answer;
  7.     cout << "請輸入第一個數字:" ;
  8.     cin >> x;
  9.     cout << "請輸入第二個數字:" ;
  10.     cin >> y;
  11.     answer = (x >= y)? x : y;
  12.     cout << answer ;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y,ans;
  7.     cout<<"請輸入第一個數:";
  8.     cin>>x;
  9.     cout<<"請輸入第二個數:";
  10.     cin>>y;
  11.     ans=(x>=y)?x:y;
  12.     cout<<ans<<endl;
  13.    
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    cout<<"<歡迎使用自動比大小軟體>"<<endl;
  7.    cout<<"<製作者 : 影武  嚴禁複製>"<<endl;
  8.    int x,y,z;
  9.    cout<<"~請輸入第一個數:";
  10.    cin>>x;
  11.    cout<<"~請輸入第二個數:";
  12.    cin>>y;
  13.    z=(x>y)?x:y;
  14.    cout<<"~兩數中較大的數為"<<z<<endl;
  15.    cout<<"<製作者 : 影武  嚴禁複製>"<<endl;
  16.    cout<<"<*~@感謝您的使用@~*r>"<<endl;
  17.    system("pause");
  18.    return 0;
  19. }
複製代碼

TOP

返回列表