Board logo

標題: 五則運算 (一) [打印本頁]

作者: tonyh    時間: 2019-7-26 10:31     標題: 五則運算 (一)

+    加
-     減
*    乘
/     除
%   取餘數


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

作者: 楊佑諺    時間: 2019-7-26 19:30

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

作者: 黃辰昊    時間: 2019-7-26 19:30

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

作者: 董宸佑    時間: 2019-7-26 19:30

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

作者: 施褕均    時間: 2019-7-26 19:34

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

作者: 黃宥華    時間: 2019-7-26 19:36

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

作者: 李宇澤    時間: 2019-7-26 19:37

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

作者: 林政瑜    時間: 2019-7-26 19:38

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int gay=1234,Gay=5678;
  7.     cout<<"如果gay代表"<<gay<<",Gay代表"<<Gay<<"時"<<endl;
  8.     cout<<"gay+Gay="<<gay+Gay<<endl;
  9.     cout<<"gay-Gay="<<gay-Gay<<endl;
  10.      cout<<"gay*Gay="<<gay*Gay<<endl;
  11.      cout<<"gay/Gay="<<gay/Gay<<endl;
  12.      cout<<"gay%Gay="<<gay%Gay<<endl;   
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

作者: 孫嘉駿    時間: 2019-7-26 19:39

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

作者: 陳宥穎    時間: 2019-7-26 19:39

本帖最後由 陳宥穎 於 2019-7-26 19:48 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=122,y=111;
  7.     cout<<"當x等於"<<x<<", y等於"<<y<<"時..."<<endl;
  8.     cout<<"x+y="<<x+y<<endl;
  9.     cout<<"x-y="<<x-y<<endl;
  10.     cout<<"x*y="<<x*y<<endl;
  11.     cout<<"x/y="<<x/y<<endl;
  12.     cout<<"x%y="<<x%y<<endl;
  13.     system("pause");
  14.     return 0;   
  15.    
  16. }
複製代碼

作者: 余有晉    時間: 2019-7-26 19:41

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

作者: 蔡忻霓    時間: 2019-7-26 19:44

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

作者: 蔡忻霓    時間: 2019-8-1 19:40

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

作者: 周之閔    時間: 2019-8-9 14:44

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





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2