Adding Large Integers

I am learning stacks, and I am trying to get this program to work. I have to be able to add large integers such as 9999999999999999999999999 by pushing all the numbers on the stack and then adding them up. Currently it works with small numbers but large numbers it crashes. I know it crashes because int can not take such a large number but what can I do to fix that problem? Please Help!!

you need to have a user defined type for performing arithmetic operations (atleast a plus) on integers with large precision. either write a big_integer class or use a library
eg:class bigint from the LiDIA library (http://www.cdc.informatik.tu-darmstadt.de/TI/LiDIA/)

C++ is extremely limited in the values you can use. For example, the int data type is only guaranteed to hold the values -32,767 to 32,767. A large integer like 9999999999999999999999999 can't be stored in a single variable of any type. So you get around it in one of two ways.

The first way is manually. You store pieces of the value in multiple variables and write functions that handle the math between those variables. This is tough, and I don't recommend it if you're not confident in your C++ abilities.

The second way is by using a library that does the manual stuff for you. This one for instance. The problem with this solution is that you have to learn a library and now you're bound to something that isn't standard.

Now, from the looks of your problem, I'd say you've been given an assignment to manually perform addition on large integers. But it's hard to be sure because you've been rather vague in the requirements. Can you describe your assignment in a little more detail? There's a possibility that you simply asked the wrong question and that's why the answers are confusing you.

>it is bringing in such a large integer
I honestly don't see what the problem is. Have you even bothered to google for how it might be accomplished? Have you even read the previous posts? Telling you to first plan how you would do it on paper then just apply it to your model/ program?

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...