Skip to main content
Mohan1
Associate III
October 22, 2019
Solved

Conversion of decimal to string

  • October 22, 2019
  • 3 replies
  • 3059 views

Hello, I am getting data in decimal format and to need to convert it into string.So how can i do it?

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    The math/logic here are pretty simple, sort of thing given as a homework assignment to check if you have some grasp of topic.

    Tip:do it backward, generating the least significant digits first.

    Library also has things like itoa() which is more lightweight than sprintf() and variants.

    http://www.cplusplus.com/reference/cstdlib/itoa/

    3 replies

    Ozone
    Principal
    October 22, 2019

    sprintf() would be the simplest way.

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    October 22, 2019

    The math/logic here are pretty simple, sort of thing given as a homework assignment to check if you have some grasp of topic.

    Tip:do it backward, generating the least significant digits first.

    Library also has things like itoa() which is more lightweight than sprintf() and variants.

    http://www.cplusplus.com/reference/cstdlib/itoa/

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Mohan1
    Mohan1Author
    Associate III
    November 1, 2019

    Thank you so much sir.I used itoa function and it shows correct decimal value in docklight that i required.Thank you once again sir.