返回列表 發帖

五則運算(二)

  1. #include<iostream> // <-基本輸出輸入的函式庫 Input Output   cin 輸入 cout 輸出  
  2. #include<cstdlib> //主要的函式庫 Library
  3. using namespace std;
  4. int main()
  5. {
  6.     int x; int y;
  7.     cout << "兩數的五則運算" <<endl;
  8.     cout << "請輸入x的值:" <<endl;
  9.     cin >> x;
  10.     cout << "請輸入y的值:" <<endl;
  11.     cin >> y;
  12.    cout << "x+y=" << x+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.     system("pause");  
  18.     return 0;  
  19. }
複製代碼

返回列表