angelos-constantinides
asked on
Binary Division with remainder
I need a function that takes as input 2 strings 1 is divident and 2 is the divisor i need this function to return me the remainder of this division string represent binary numbers with regular expression (0|1)* the quotient must be returned via pointer
i want this function to return a string as well
for example char *binremainder(char *divident,char *divisor,char *quotient);
Language Interface Required is ANSI C.
ASAP
thnx in advance
i want this function to return a string as well
for example char *binremainder(char *divident,char *divisor,char *quotient);
Language Interface Required is ANSI C.
ASAP
thnx in advance
The alternative is to implement the binary division yourself :
http://en.wikipedia.org/wiki/Binary_numeral_system#Division
(the same way you perform a long (decimal) division)
http://en.wikipedia.org/wiki/Binary_numeral_system#Division
(the same way you perform a long (decimal) division)
ASKER
The reason I need in string is because it is required by the rest source code converting it to integers is not an option because the exceed the limitations of C language
trying to convert to integer will result in a number greater that max int.
trying to convert to integer will result in a number greater that max int.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> trying to convert to integer will result in a number greater that max int.
Ok, then go with my second suggestion :)
Ok, then go with my second suggestion :)
Which is what I'd suggest too : convert the strings to ints, perform an int modulo, and convert the result back to a string.