Problem regarding add and sub of two big numbers in c++

  • 12 years ago

    hi friend..

    i got assignement.. 

    to write program to add or subtract two big integer numbers. “Big” refers to a number which is more than 30 digits. You can assume that the number may have MAXIMUM 100 digits. Your program should have the data structures to hold such a big number. Also it should have two functions viz Add and Subtract and a main function which demonstrates the usage of Add and Subtract.

     

    e.g of one such operation  12334444446666666666888888812233 + 2222227889999999999 = 12334444446668888894778888812232

     

    friends can u tell me how to solve this problem.. i dont know how to use datastructure..

    plz anyone send any sample code or any related url...

    so i can do this..

    its urgent..

    Thanks In Advance..

    Prashant 

  • 12 years ago

    Hi prashant11,

    You can use array or linked list and the like. Then use each element(node) as a digit of your big number. When you want to do the calculations, just use the arithmetic rules. I'm tired to coding here! but do something then ask, and make me happy! Smiley Face

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Engineers are all basically high-functioning autistics who have no idea how normal people do stuff.” - Cory Doctorow