![]() |
|
#1
|
|||
|
|||
Multiply Really Big Integer in Char *Hello to all C== expect programmer, i want create a program which multiply two o char * integer.
I not asking you all to write for me but pointer and guide is really appreciated by me and others. Thanks for your help. |
|||
|
#2
|
|||
|
|||
Re: Multiply Really Big Integer in Char *Do you mean, that your numbers are stored as text and you want to multiply those two strings?
If that is the case I would suggest searching for "c++ big int". There are tons of classes and functions out there that can parse strings and do arithmetics with that. |
|
#3
|
|||
|
|||
Re: Multiply Really Big Integer in Char *Yes, absolutely right.
Thank for your suggestion. |
|
#4
|
|||
|
|||
Re: Multiply Really Big Integer in Char *Before i started to post for help in this forums, i have think out of two algorithm by my own.
1. Multiply digit by digit. 2. Another algorithm is split the string number into two parts and multiply digit by digit also. Therefore, karatsuba algorithm look similar to my second method. I decided to focus in it but carry number is the problem. Besides that, i also not fully understand the whole algorithms. I just understand part of it from Quote:
Explanation is greatly appreciated by me and others. A billion thanks for your help. |
|
#5
|
|||
|
|||
Re: Multiply Really Big Integer in Char *I am not sure if I understand that algorithm myself correctly but here are some more links that may help you:
http://en.wikipedia.org/wiki/Multiplication_algorithm http://en.wikipedia.org/wiki/Karatsuba_algorithm In the Kratsuba algorithm article in the "External Links" section you will find a link to this site: http://utilitymill.com/utility/Karatsuba_Multiplication There you can find this code (no clue what language that is but seems readable): Code:
The conversion to text seems to be missing here... Do you have to write an algorithm by hand or would using something already written by someone else suffice (Homework/Just get the work done)? |
|
#6
|
|||
|
|||
Re: Multiply Really Big Integer in Char *I prefer to learn Karatsuba algorithm with recursion.
Quote:
number1 = 12, number2=12; Result = C-A-B =4 == X1y2 + x2y1=4; Code:
I almost understand three multiply operation but doesn't the last statement and how to implement in recursion? Explanation is greatly appreciated by me Last edited by admin : 13-Jul-2008 at 01:19.
Reason: Please insert your example codes between [CODE] and [/CODE] tags
|
|
#7
|
|||
|
|||
Re: Multiply Really Big Integer in Char *When the three multiplications are done the result can be computed by
Code:
Of course each of the three multiplications will start a recursion. Recursion will stop when one of the factors becomes a single digit number. CPP / C++ / C Code:
I guess you already found that out by your self... So could you maybe phrase a little more precisely what part you don't understand? EDIT 1: fixed punctuation |
|
#8
|
|||
|
|||
Re: Multiply Really Big Integer in Char *1. I don't understand this statement.
CPP / C++ / C Code:
2. How to implement recursion for Multiply() ? Quote:
The recursion is happen in multiply and not max. Please help me. |
|
#9
|
|||
|
|||
Re: Multiply Really Big Integer in Char *1. What makes you not understand the expression?
Is it the C++ or the algorithm? 2. The function does recurse by calling it self in it self: CPP / C++ / C Code:
|
|
#10
|
|||
|
|||
Re: Multiply Really Big Integer in Char *Wikipedia has a good article on recursion with examples. Maybe in your native language too
http://en.wikipedia.org/wiki/Recursion |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pointer initialization causing program abend? | emanresu | C Programming Language | 0 | 12-Dec-2006 11:36 |
| lvalue compile error | emanresu | C Programming Language | 7 | 16-Nov-2006 11:22 |
| getting an error while compiling and running using different IDE. | jaro | C Programming Language | 0 | 25-Aug-2006 10:14 |
| Memory cannot be read? | dlare9 | C Programming Language | 3 | 16-Nov-2005 08:03 |
| [Tutorial] Pointers in C (Part I) | Stack Overflow | C Programming Language | 1 | 08-Apr-2005 19:35 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The