How do you put a repeating decimal into c++ code for example 10.7333333 repeating the 3
How do you put a repeating decimal into c++ code for example 10.7333333 repeating the 3
There are fundamental limits on how many useful digits a number like that will contain anyway. So you can write 10.73333 for your purposes. If you really care, you can do some math like 10.4 + 1.0 / 3.0
well i need to declare it in my code because the variable G = 32.2 ft/s^2 so i need to convert it to yds/s^2 and the number is 10.73 with the 3 repeating
Yeah, divide by 3, like every other feet to yard conversion. The math will be correct.
okay so im new to this will the require me to put #include <math.h>?
If you use functions from math.h, then yes you do. I don't know from the information that you gave me that you are actually using any math functions. You can divide without a library.
what do you mean by math functions?
The link in my previous post actually lists all of them. If you aren't using any, then no reason to include cmath exists.
okay thank you so much!!!