storing a huge number in a variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsn
    New Member
    • Sep 2007
    • 237

    storing a huge number in a variable

    i want to store a number which is going to be greater than 0 and <=10^1000
    which variable will help me to store this number in it.
    after storing it i have to check if it is divisible by another number.

    please help me guys

    regards
    hsn
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Hard to say. 32-bit OS?? 64-bit OS ?? Windows?? Unix/Linux??Can you tolerate rounding??

    Have you read a C++ book about sizeof and capacities of the built-in types??

    Comment

    • beacon
      Contributor
      • Aug 2007
      • 579

      #3
      Do you mean which variable type...like int or double?

      Have you tried DWORD? I'm still somewhat new to C++, so I could very well be wrong, but I know I had to use it in a program I wrote last semester on the time it takes for different sorting algorithms to finish sorting because the time was greater than 2xxxxxxxx or something.

      If you want to try it, you declare it just the same as you would an integer or a double.

      ex: DWORD x

      x = 10^1000

      Hope this helps...

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        A DWORD is a Microsoft whiz-bang for a long.

        [code=c]
        typedef long DWORD;
        [/code]

        Comment

        Working...