Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 12 digit number calculation

12 digit number calculation

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ram Murali
    wrote on last edited by
    #1

    Hi all, I have a difficulty in finding difference between two 12 digit number. my problem is this 9999 9999 9999 - 1111 1111 1111 = 8888 8888 8888. I wish to do this operation. But i couldnt able to store these two 12 digit numbers as a integer. can anyone please suggest me some ideas? Thanks in advance.

    Regards, Ram

    N 1 Reply Last reply
    0
    • R Ram Murali

      Hi all, I have a difficulty in finding difference between two 12 digit number. my problem is this 9999 9999 9999 - 1111 1111 1111 = 8888 8888 8888. I wish to do this operation. But i couldnt able to store these two 12 digit numbers as a integer. can anyone please suggest me some ideas? Thanks in advance.

      Regards, Ram

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      use __int64. __int64 nNum1 = 999999999999; __int64 nNum2 = 111111111111; __int64 nResult = nNum1 - nNum2;

      nave

      R 2 Replies Last reply
      0
      • N Naveen

        use __int64. __int64 nNum1 = 999999999999; __int64 nNum2 = 111111111111; __int64 nResult = nNum1 - nNum2;

        nave

        R Offline
        R Offline
        Ram Murali
        wrote on last edited by
        #3

        How can i convert sring to _int64? because my "9999 9999 9999" and "1111 1111 1111" is a string. I need to convert these string values to _int64 and do the subtraction. after do the operation, i need to convert the result from _int64 to string. is there any way to do it? Thanks a lot.

        Regards, Ram

        N 1 Reply Last reply
        0
        • R Ram Murali

          How can i convert sring to _int64? because my "9999 9999 9999" and "1111 1111 1111" is a string. I need to convert these string values to _int64 and do the subtraction. after do the operation, i need to convert the result from _int64 to string. is there any way to do it? Thanks a lot.

          Regards, Ram

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          Ram Murali wrote:

          How can i convert sring to _int64?

          use _atoi64() to convert string to _int64 type. and after convertion use _i64toa() to convert it back to string.

          nave

          1 Reply Last reply
          0
          • N Naveen

            use __int64. __int64 nNum1 = 999999999999; __int64 nNum2 = 111111111111; __int64 nResult = nNum1 - nNum2;

            nave

            R Offline
            R Offline
            Ram Murali
            wrote on last edited by
            #5

            Thanks for your information. I found the function to convert the string value to the _int64. CString str = "999999999999"; _int64 val = _atoi64(str); Thanks again.

            Regards, Ram

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups