Click here to Skip to main content
15,937,127 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone, I need a method for divide two big numbers in string,( console app. and in c++ )
for example :
string s1 = "4234823759252523523502525234232"...( about 100 char numbers )"
string s2 = "243423423423"...also like above"

string Result = Divide(s1,s2);

Thank you.
joshrduncan2012 8-Apr-13 16:26pm    
Great thing to ask google. Not a question, btw.
[no name] 10-Apr-13 6:09am    
yes, but my problem didn't solve there(Google). :D
Matt T Heffron 8-Apr-13 16:44pm    
How would you do it if you wrote the numbers out on paper and did the "long division"?
Well, that's what you need to code.
Give that a try and if you have specific problems with the implementation, then ask for help here.
[no name] 10-Apr-13 6:07am    
i did those things and i coded this method, actually i programmed a console app. that has 4 methods ; sum minus multiply divide for BIG numbers in string format and the main method, i felt something went wrong when i saw the whole program has 400 linen, is that too much or ....
thank you anyway for answering, Matt T Heffron
Matt T Heffron 10-Apr-13 13:00pm    
400 lines does not seem like a seriously excessive length.
An experienced programmer could probably trim off a bit.

1 solution

This is a well-known problem related to some class which is usually called "BigInteger" or "BigInt".

These are some of the implementations:[^],[^],[^].

You can try to find some more:[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900