I wish to store an integer wid a 1000 digits for a program in C++.Please suggest me a datatype i should use.I'm using a 64 bit computer but the dev c++ i'm using is 32 bit.

Recommended Answers

If you want to use an IDE, there are a number of choices. In no particular order, off the top of my head:

CodeBlocks
QT Creator
Eclipse
NetBeans
Orwell's updated Dev C++
Whatever version of Visual Studio is free at the moment from Microsoft

Alternatively, I always like to recommend …

Jump to Post

All 4 Replies

search bigint, but I don't know much about it yet.

As Pinku says, you need a new type.

You have two options. Either you can use one of the existing libraries that handle types this large, or you can handle it yourself.

I usually point people towards the GNU Bignum library, but others exist.

If you decide to handle it yourself, there are many options. For example, you could store the value as a string, and define your own operations (+, -, /, *) for working on those values. Alternatively, you could make each of these big values a linked list in which each node in the list holds one of the digits, and again implement your own basic operations. There are many ways to do it.

If you're using Bloodshed Dev C++, please don't. It's an awful choice and you're doing yourself no favours.

@Moschops Wat should i use instead of Dev C++?

If you want to use an IDE, there are a number of choices. In no particular order, off the top of my head:

CodeBlocks
QT Creator
Eclipse
NetBeans
Orwell's updated Dev C++
Whatever version of Visual Studio is free at the moment from Microsoft

Alternatively, I always like to recommend beginners at least learn how to use their compiler by hand, in which case you need no more a modern compiler (Clang/LLVM or the GCC are good choices), a text editor, and a couple of build tools such as Make.

Be a part of the DaniWeb community

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