0

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.

3
Contributors
4
Replies
21
Views
3 Years
Discussion Span
Last Post by Moschops
0

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

Edited by Pinku Deb: *typo

0

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.

Edited by Moschops

0

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

Edited by microlifecc

1

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.