25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
255 B

  1. #include "jian.h"
  2. #include <limits>
  3. bool Sub(int a, int b, int *d)
  4. {
  5. if ((a>0 &&b<0 && a >( INT_MAX + b)) ||( a<0 && b>0 && a < (INT_MIN + b)))
  6. {
  7. return false;
  8. }
  9. else
  10. {
  11. *d = a - b;
  12. return true;
  13. }
  14. }
  15. int sub(int a, int b)
  16. {
  17. return a - b;
  18. }