Hey guys, trying to write a program using the floor function that outputs a whole integer, rounded to the tenths, rounded to the hundredths, and finally rounded to the thousandths. This in the code I have currently, but its outputting the hundredths and thousands the same, almost like the floor function isn't even working. Any suggestions?
Are you sure you had sufficient digits? When I tried it with 1.12345678, I got exactly the output I would expect. So I think maybe you should check your input or rebuild your program, as this source code seems correct.
I think you need to check out http://www.cplusplus.com/reference/cmath/floor/ and understand how floor works. Because what you are expecting and what you are doing in your functions are two different things.
During my dinner break I realized that rounding to the tenths, hundredths and thousandths place will not work with the floor function. Check out these links to work with the right side of the decimal: