0

Is there a function that return a decimal point value from a double/float ?

Maybe there's a function that I don't know, that works a little bit like this: double x = 699.25; int n = getPoint(x); std::cout << n; //outputs 25 You get the point. Is there a function, or a way I can do that? Thanks in advance!

31st May 2019, 8:50 AM
Noverdi Ramadhan
Noverdi Ramadhan - avatar
3 Antworten
+ 2
double x=22.336; int y=(int)x; double d=(int)((x-y)*1000); this should work
31st May 2019, 9:05 AM
Farry
Farry - avatar
+ 1
Thanks for the answer!
1st Jun 2019, 2:41 AM
Noverdi Ramadhan
Noverdi Ramadhan - avatar