cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of decimal to string

Mohan1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions

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
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3
Ozone
Lead

sprintf() would be the simplest way.

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
Up vote any posts that you find helpful, it shows what's working..

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.