返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6. int a,b;

  7. cout<<"請輸入a:";
  8. cin>>a;
  9. cout<<"請輸入b:";
  10. cin>>b;

  11. cout<<"a="<<a<<endl;
  12. cout<<"b="<<b<<endl;

  13. if(a>b)
  14. {
  15.        cout<<"a大於b"<<endl;
  16.        }
  17. else if(a<b)
  18. {
  19.      cout<<"a小於b"<<endl;
  20.      }
  21.      else
  22.      {
  23.      cout<<"a等於b"<<endl;
  24.      }
  25. system("pause");
  26. return 0;
  27. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int x;
  7.    cin>>x;
  8.    cout<<"當x值為"<<x<<endl;
  9.    int y;
  10.    cin>>y;
  11.    cout<<"當y值為"<<y<<endl;
  12.    cout<<"當x值為"<<x<<",當y值為時"<<y<<endl;
  13.    cout<<"x+y="<<x+y<<endl;
  14.    cout<<"x-y="<<x-y<<endl;
  15.    cout<<"x*y="<<x*y<<endl;
  16.    cout<<"x/y="<<x/y<<endl;
  17.    cout<<"x%y="<<x%y<<endl;
  18.    system("pause");
  19.    return 0;
  20. }
複製代碼

TOP

返回列表