Iteration through the decimal part of a double? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Iteration through the decimal part of a double?

I have a double a = 123.123456 I need a program that outputs 123456. Edit: Not output, but to store the digits in a char array.

27th Jun 2016, 10:06 PM
Garme Kain
Garme Kain - avatar
4 Answers
0
I've written this program but the output is far from being the needed one. http://www.sololearn.com/app/cplusplus/playground/cVdfGaY4IEXh/
27th Jun 2016, 10:22 PM
Garme Kain
Garme Kain - avatar
0
http://www.sololearn.com/app/cplusplus/playground/c83sz3Wbx4Kx/
28th Jun 2016, 6:22 AM
Nisarg Uchiha
Nisarg Uchiha - avatar
0
The goal here is to be able to convert it into char array.
28th Jun 2016, 9:24 AM
Garme Kain
Garme Kain - avatar
- 1
Float f = 123.123456; Int I = f; Cout << f - I;
30th Jun 2016, 12:43 AM
Francesco Galisi
Francesco Galisi - avatar