C++
So i need a way to get say the number 7 from the double 56.279 or any other of the integers and i cannot figure out how to do it without having the knowledge of what the double returned from my function is going to be (so i cant simply do 56.279 - .009).
My function alway returns seconds elapsed as a double in this form: 000.000. I also only have 5 character spaces to print the time to the CONSOLE window so
if the number is less than ten i need to simply print 0.000 sec, if more than ten 00.00, if more than sixty seconds (one minute) then 0:00, and finally if more than 10 minutes i will print 00:00 in the 5 character space. I need to therefore get rid of the 9 in the 56.279 so the number fits in the space. I'm thinking i need to simply get each number individually except for 9 and insert them into a char array...
Any other ideas?
Thanks!
To have the n decimal number of your double x you can do E((x modulo x*10^(n-1))*10)
You can multiply by a power of ten, and then round down.