The problem states that 2 integers are going to be the input.
These 2 integers should be divided and the output should be a mixed fraction of these 2 integers. With whitespace separating the output tokens.
Such as:
27 12
2 3 / 12
A line containing 0 0 will follow the last test case.
So an example could be:
My code has a problem that if I input a huge number, it will sometimes crash, and sometimes loop the cout of the answer of that large number nonstop, what can I do to fix this?
Because the problem states that each test case contains two integers in the range [1; 2^31 – 1]. The first number is the numerator and the second is the denominator.
My bad it was supposed to be iA<= 2147483647 && iB <=2147483647
Input specification says what the user is allowed to input, not what the program should verify. So, your program should assume (and not verify) that the input numbers are from the specified range.
By the way, a variable of type int can not have a value greater than 2^31-1, anyway. If the user tries to input a bigger number, the variable will not have the exact value that was input.
iA>= 2147483647 && iB >=2147483647
That is unnecessary, because a signed long has a max size of 214...647. https://msdn.microsoft.com/en-us/library/296az74e.aspx
Also, signed long, just replace it with int, because they're the same thing.
If the problem states that the input is in a certain range, then that's a contract. You don't need to check that the input is actually in that range, you just need to be able to handle all inputs in that range. If the input happens to not be in that range, your program is allowed to output garbage or even crash without breaking the contract.
if I input a huge number, it will sometimes crash, and sometimes loop the cout of the answer of that large number nonstop
I can't reproduce this or see any way it could happen.
Ohh okay I got it now. Helios, it would happen if I had done an imput with a large number equal to or bigger than 12 digits, but now I've switched from cout and cin to printf and scanf and it appears to work.
Thank you all so much!