Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double al = scnd_num_min(num1, Oprt);
- al = al * (-1);
- double ah = scnd_num_max(num1, Oprt);
- cout << "Please enter a value within a range of: " << "n" << fixed << al;
- cout << " and " << ah << " : ";
- double scnd_num_max(double num1, char Oprt)
- {
- double max1 = 9223372036854775807;
- double max2 = 9223372036854775806;
- double min1 = -9223372036854775806;
- switch(Oprt)
- {
- case '+':
- if (num1 <= 0)
- return max1;
- else
- return (max1 - num1);
- case '-':
- if (num1 >= -1)
- return max1;
- else
- return ((max1 - (num1 * (-1)))+1);
- case '*':
- if ((num1 < min1) || (num1 > max2))
- return 1;
- else if (num1 == 0)
- return max2;
- else if (num1 > 0)
- return (max2 / num1);
- else
- return (max2 / (num1 * (-1)));
- case '/':
- return max2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement