Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. double al = scnd_num_min(num1, Oprt);
  2. al = al * (-1);
  3. double ah = scnd_num_max(num1, Oprt);
  4.  
  5. cout << "Please enter a value within a range of: " << "n" << fixed << al;
  6. cout << " and " << ah << " : ";
  7.  
  8. double scnd_num_max(double num1, char Oprt)
  9. {
  10. double max1 = 9223372036854775807;
  11. double max2 = 9223372036854775806;
  12. double min1 = -9223372036854775806;
  13. switch(Oprt)
  14. {
  15. case '+':
  16. if (num1 <= 0)
  17. return max1;
  18. else
  19. return (max1 - num1);
  20. case '-':
  21. if (num1 >= -1)
  22. return max1;
  23. else
  24. return ((max1 - (num1 * (-1)))+1);
  25. case '*':
  26. if ((num1 < min1) || (num1 > max2))
  27. return 1;
  28. else if (num1 == 0)
  29. return max2;
  30. else if (num1 > 0)
  31. return (max2 / num1);
  32. else
  33. return (max2 / (num1 * (-1)));
  34. case '/':
  35. return max2;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement