Can some one review my program an see if it is doing the math correctly. I think it is running right but I would like to get a second opinion if I could. The function of the program is to convert meters, into yards, feet, and inches.
Thank you for the help.
I don't know much about yards, feet, and inches but I think something is wrong because when I input 7 meters I get negative inches.
Another thought is that you might want to allow the user to enter the meters as a decimal number. All you would have to do is to change the type so it's very easy.
You don't want to use a loop. Integer division should do just fine.
Lets say that I have 42,5 fobs and one gek is 13 fobs.
static_cast<int>(42,5) / 13 == 3
In other words, 42,5 fobs contains 3 gek. 3 gek == 39 fobs.
42,5 - 39 == 3,5
Answer: 3 gek and 3,5 fobs.
Determine the yards first. Determine the feet from the remainder. What is left, is inches.