返回列表 發帖

五則運算 (一)

  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. }
複製代碼

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

  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. }
複製代碼

TOP

返回列表