Board logo

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

作者: 周政輝    時間: 2017-8-1 15:48     標題: 五則運算

+  加
-   減     
*  乘
/   除
% 取餘數
  1. #include<iostream> // 引入標頭檔 Input & Output  用來做輸入和輸出使用
  2. #include<cstdlib> // 引入標頭檔函式庫
  3. using namespace std;//命名空間
  4. int main()
  5. {   

  6.     int number1 = 23;
  7.     int number2 = 7;
  8.    
  9.     cout << number1+number2 << endl;
  10.     cout << number1-number2 << endl;
  11.     cout << number1*number2 << endl;
  12.     cout << number1/number2 << endl;
  13.     cout << number1%number2 << endl; //取餘數
  14.    
  15.     system("pause"); //按任意鍵結束程式 +
  16.    
  17. }
複製代碼

作者: 林孟霆    時間: 2017-8-1 15:52

本帖最後由 林孟霆 於 2017-8-1 15:54 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int number1=30;
  7.     int number2=5;
  8.     cout<<number1+number2<<endl;
  9.     cout<<number1-number2<<endl;
  10.     cout<<number1*number2<<endl;
  11.     cout<<number1/number2<<endl;
  12.     cout<<number1%number2<<endl;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

作者: 楊詠竣    時間: 2017-8-1 15:53

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

作者: 楊詠翔    時間: 2017-8-1 15:53

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

作者: 蘇昱全    時間: 2017-8-1 15:54

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    
  7.     int number1=3;
  8.     int number2=7;
  9.    
  10.     cout<<number1+number2<<endl;
  11.     cout<<number1-number2<<endl;
  12.      cout<<number1*number2<<endl;
  13.      cout<<number1/number2<<endl;
  14.       cout<<number1%number2<<endl;
  15.       
  16.     system("pause");
  17. }
複製代碼

作者: 蔣皓宸    時間: 2017-8-1 15:54

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

作者: 石庭禎    時間: 2017-8-1 15:55

#include<iostream>  
#include<cstdlib>  
using namespace std;
int main()
{
   
    int number1 = 23;
    int number2 = 7;
   
    cout << number1+number2 << endl;
    cout << number1-number2 << endl;
    cout << number1*number2 << endl;
    cout << number1/number2 << endl;
    cout << number1%number2 << endl; //取餘數
   
    system("pause");
    return 0;
作者: 郭采納    時間: 2017-8-1 15:55

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

作者: 林廷融    時間: 2017-8-1 15:55

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. cout<<"555555"<<endl;
  7. int number = 10;
  8. cin>>number;
  9. cout<<number<<endl;
  10. cout<<"你輸入的文字是:"<<number<<endl;


  11. int x=23,y=7;
  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.          
  20.          
  21. }
複製代碼

作者: 尤靖瑗    時間: 2017-8-1 15:57

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

作者: 陳智鈞    時間: 2017-8-1 15:59

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

作者: 湯東緯    時間: 2017-8-1 16:00

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int number=0;
  7. string str="";
  8. cout<<number<<endl;
  9. cin>>number;
  10. cin>>str;
  11. cout<<"x+y="<<x+y<<endl;
  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<<str<<endl;
  17. system("pause");
  18. return 0;   
  19. }
複製代碼

作者: 郭宗翰    時間: 2017-8-1 16:00

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    
  7.     int x= 23;int y = 7;
  8.    
  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.     cout<<"x%y="<<x%y<<endl;
  14.    
  15.    
  16.    
  17.    
  18.    
  19.     system("pause");
  20.     return 0;
  21. }
複製代碼

作者: 鄭稟燁    時間: 2017-8-1 16:00

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int number1=23
  7.    int number2=7
  8.    
  9.    cout<<number1+number2<<endl;
  10.    cout<<number1-number2<<endl;
  11.    cout<<number1*number2<<endl;
  12.    cout<<number1/number2<<endl;
  13.    cout<<number1%number2<<endl;
  14. }
複製代碼

作者: 蔡佾辰    時間: 2017-8-1 16:01

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int number1=23;
  7. int number2=7;

  8.    cout<<number1+number2<<endl;
  9.     cout<<number1-number2<<endl;
  10.     cout<<number1*number2<<endl;
  11.     cout<<number1/number2<<endl;
  12.     cout<<number1%number2<<endl;
  13.    
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

作者: 黃宇綸    時間: 2017-8-1 16:01

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int  number1=58;int number2=93;
   cout<<number1+number2<<endl;
   cout<<number1-number2<<endl;
   cout<<number1*number2<<endl;
   cout<<number1/number2<<endl;
   cout<<number1%number2<<endl;
   system("pause");
   return 0;  

}
作者: 胡綵玲    時間: 2017-8-1 16:02

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
  int x=23;
  int y=7;
  cout<<"當x的值為"<<x<<",y的值為"<<y<<"時..."<<endl;
  cout<<"x+y="<<x+y<<endl;
  cout<<"x-y="<<x-y<<endl;
  cout<<"x*y="<<x*y<<endl;
  cout<<"x/y="<<x/y<<endl;
  cout<<"x%Y="<<x%y<<endl;
   
  string str="";
  float flo=0;
//  cin>>number;
// cout<<number<<endl;

  cout<<str<<endl;
  system("pause");
  return 0;   
}
作者: 黃宇瑄    時間: 2017-8-1 16:02

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

作者: 尤靖評    時間: 2017-8-1 16:03

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int number1=23;
  7.      int number2=7;
  8.      cout<<number1+number2<<endl;
  9.      cout<<number1-number2<<endl;
  10.      cout<<number1*number2<<endl;
  11.      cout<<number1/number2<<endl;
  12.      cout<<number1%number2<<endl;
  13.     system("pause");
  14.     return 0;
複製代碼

作者: 林子勛    時間: 2017-8-1 16:04

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x=23,y=7;
  7.     cout<<"x+y="<<x+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.    
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

作者: 林翊卉    時間: 2017-8-1 17:24

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. cout<<"555555"<<endl;
  7. int number = 10;
  8. cin>>number;
  9. cout<<number<<endl;
  10. cout<<"你輸入的文字是:"<<number<<endl;


  11. int x=23,y=7;
  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.          
  20.          
  21. }
複製代碼

作者: 林翊卉    時間: 2017-8-1 17:25

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. cout<<"555555"<<endl;
  7. int number = 10;
  8. cin>>number;
  9. cout<<number<<endl;
  10. cout<<"你輸入的文字是:"<<number<<endl;


  11. int x=23,y=7;
  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.          
  20.          
  21. }
複製代碼

作者: 林翊卉    時間: 2017-8-1 17:29

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
cout<<"555555"<<endl;
int number = 10;
cin>>number;
cout<<number<<endl;
cout<<"你輸入的文字是:"<<number<<endl;


int x=23,y=7;
cout<<"x+y="<<x+y<<endl;
cout<<"x-y="<<x-y<<endl;
cout<<"x*y="<<x*y<<endl;
cout<<"x/y="<<x/y<<endl;
cout<<"x%y="<<x%y<<endl;


















system("pause");
return 0;      
         
         
}
作者: 石庭禎    時間: 2017-8-2 14:18

cout<<"2017谷哥人程式體驗營"<<endl;
    cout<<"學生:石庭禎"<<endl;
    system("pause");
  system("pause");
return 0;
  1. cout<<"2017谷哥人程式體驗營"<<endl;
  2.     cout<<"學生:石庭禎"<<endl;
  3.     system("pause");
  4.   system("pause");
  5. return 0;
複製代碼





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