Is there a data type that can allow a user to input a 25 digit number... because the largest data type for numbers that i know is long long int and uintmax_t which can only store 18 numbers (i'm not sure about this)... because my problem should allow a user to input 25 numbers... If a larger data type is impossible, is there another way??? (I'm a beginner to c++ and i'm really sorry if this question sounds stupid) :)

A 64bit integer is the largest native type currently in C++. However you are not the first person to have this problem and the way round it is to use a big integer classes. Classes of this nature can normally hold any number of digits which they do by using a vector of smaller integers to hold the values.

If you want you could try writing one yourself, it is a quite interesting exercise but if you just want to get on with the coding then try looking at Boost or googling "C++ BigInt"

Using a BigInt library is one solution.

Also, what are those digits?

If this is just a very big number, then you might just use a floating-point type instead (`float` or `double`) which don't really have an upper-limit (well, they do, but it's like 1e308), and instead, have a limited-precision (about 18 significant digits).

If the digits are actually something like a serial number, social security number, bank account number or anything like that, then you most likely don't need to be doing any math operations on those numbers (e.g., you can't add two social security numbers!). So, in this case, you don't really need to store the number as an actual number (integer), but instead, you could just store it as a string (text), or some other ad hoc representation (like 5 integers, one for each chunk of 5 digits). That's what you normally do for long numbers that are not mathematical in nature. This is because the BigInt classes are usually overkill for this situation because of all the math operations they bring into the picture (that you won't use).

There are a number of unlimited precision math tools. The most used one is probably boost. Here is a wikipedia article about arbitray precision math tools: http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

OpenSSL support large number as well, you might want to take a look on it.

If you would like some ideas about coding / using big Integers, this link may give you a start ...

Big Numbers

Also, you may like to know that Python comes with big integers ... (and big decimal precision also) ... so you may like to consider doing your program in Python?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.