Hi.
I'm not a native, sorry if something is wrong with the writings.
I have two problems with this program.
the first one is with countOfDigit function. when I enter a number that has more than 12 digits, it return 12 as the number of digits. when I tracked the program I understood that after the 12th division, it outputs "inf". how should I stop this?
the second problem is with digitsOfNum function. It should return the number in the specified range. for example if you enter 123456, 2, 3 it should return 345 but it returns 543!
the first one is with countOfDigit function. when I enter a number that has more than 12 digits, it return 12 as the number of digits. when I tracked the program I understood that after the 12th division, it outputs "inf". how should I stop this?
The only way is to use a variable type that can handle more than 12 digits.
Some examples are:
Or as some programmers here may suggest, writing your own BigInt class. But unless you need 1000 digit numbers or something, just use the available types.
the second problem is with digitsOfNum function. It should return the number in the specified range. for example if you enter 123456, 2, 3 it should return 345 but it returns 543!
Try reversing the order you store the numbers in the vector (or reverse the order you combine the digits).