返回列表 發帖

[隨堂測驗] 基本輸入輸出 (二)

本帖最後由 陳品肇 於 2019-1-28 15:30 編輯

試實作如下之執行畫面:
  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+b="<<a+b<<endl;   
  12.     cout<<"a-b="<<a-b<<endl;
  13.     cout<<"a*b="<<a*b<<endl;
  14.     cout<<"a/b="<<a/b<<endl;
  15.     cout<<"a%b="<<a%b<<endl; //取餘數
  16.     system("pause");      
  17.     return 0;              
  18. }
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

返回列表