Click to See Complete Forum and Search --> : please help the newbiest


frikova
April 29th, 2003, 01:49 PM
i need to do a c++ program able multiply 2 one hundred digits numbers, i guess i must use arrays

kuphryn
April 29th, 2003, 04:25 PM
I recommend you work a simple problem out on paper first. The program is not hard. You just have to be careful.

Kuphryn

frikova
April 29th, 2003, 04:59 PM
i tried. but please, i need a clue! (or the whole program ;) )

Paul McKenzie
April 29th, 2003, 05:51 PM
Originally posted by frikova
i tried. but please, i need a clue! (or the whole program ;) ) What have you tried? What don't you understand about the assignment? And no, you won't get the whole program.

Basically, the assignment is asking you to write a program that acts the same way you would multiply two 100 digit numbers with pencil and paper.

The program is asking you to use an array to hold each digit of the 100 digit number. Then you multiply, just like you did as a child, the numbers from right to left. This means, you have to keep track of the carry, the "sub-answers", etc. Then you add up the sub-answers at the end.

If this is hard, just try a two digit number or a three-digit number. Think of how you would set up the arrays, multiplications, carry's, etc. Then you expand this to 100 digits. If you can't understand how to do two digits, then it won't be any use trying 100 digits.

Regards,

Paul McKenzie

frikova
April 29th, 2003, 06:04 PM
thanks for that. Actually the whole program thing was a joke ( did u see the ;) ?) thanks a lot for the help