Board logo

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

作者: 歐柏罕    時間: 2017-9-25 20:35     標題: 五則運算 (一)

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

作者: 彭煥宇    時間: 2017-9-25 20:36

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

作者: 盧佑芯    時間: 2017-9-25 20:37

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.   int num = 10;
  7.   int num2 = 11;  
  8.   cout<<num<<"+"<<num2<<"="<<num+num2<<endl;
  9.   cout<<num<<"-"<<num2<<"="<<num-num2<<endl;
  10.   cout<<num<<"*"<<num2<<"="<<num*num2<<endl;
  11.   cout<<num<<"/"<<num2<<"="<<num/num2<<endl;
  12.   cout<<num<<"%"<<num2<<"="<<num%num2<<endl;


  13.   
  14.   system("pause");
  15.   return 0;   
  16. }
複製代碼

作者: 盧佑恩    時間: 2017-9-25 20:37

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

作者: 洪翊展    時間: 2017-9-25 20:37

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

作者: 曾堂桂    時間: 2017-9-25 20:38

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

作者: 李治毅    時間: 2017-9-25 20:38

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

作者: 沈子晏    時間: 2017-9-25 20:39

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {

  6.     int num =10;
  7.     int num2 =5;
  8.     cout << num <<"+"<< num2 <<"="<< num+num2 << endl;
  9.     cout << num <<"-"<< num2 <<"="<< num-num2 << endl;
  10.     cout << num <<"*"<< num2 <<"="<< num*num2 << endl;
  11.     cout << num <<"/"<< num2 <<"="<< num/num2 << endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

作者: 洪翊展    時間: 2017-10-2 19:47

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





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