Simple Inches to Feet/inches Problem

I'm not exactly sure what to do here. I've tried to write code for it but here's the actual problem.

Say I have 89 inches and I want it to show as 7 feet 5 inches, how do I get it to split up? the obvious thing i've tried to do is divide the inches by 12 to get the feet but i'm still confused on how to get that extra bit of inches. Any help would be appreciated but i'm probably making this out harder than it should be.
Modulus. Google it up.
divide by 12 to get the feet, modulus by 12 to get the inches.
Although mdulus would be a much better way to solve this problem you've just got to think out side the box here a little bit. When you divide it by 12 you get the number of feet. Store this into an int variable (make sure to static cast because the result will usually be of type double and the decimal portion is your inches but not in the format you want them so we will knock them off for now). Now think about this. What would happen if you multipy your new found feet by 12 and subtract that from the total inches? Would you not be left with the remaining inches? This is by no means the most efficient way to solve this so I strongly recommend looking up modulus.
When you don't know something is available learn to look it up or think outside of the box with what you already know because there are often times that there are more than 1 answer to a problem. Good luck.
Topic archived. No new replies allowed.