CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Posts
    4

    please, please help the newbiest!!!

    i need to do a c++ program able multiply 2 one hundred digits numbers, i guess i must use arrays
    Last edited by frikova; April 29th, 2003 at 04:56 PM.

  2. #2
    Join Date
    Feb 2002
    Posts
    5,757
    I recommend you work a simple problem out on paper first. The program is not hard. You just have to be careful.

    Kuphryn

  3. #3
    Join Date
    Apr 2003
    Posts
    4

    Post

    i tried. but please, i need a clue! (or the whole program )

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449
    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

  5. #5
    Join Date
    Apr 2003
    Posts
    4
    thanks for that. Actually the whole program thing was a joke ( did u see the ?) thanks a lot for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured