Response to C++: Main 2009-10-29 21:06:37
Hey C++. i've got a question with decimals. I'm just starting out with C++ and i'm trying to code a program that will calculate simple interest.
The Simple interest equation is I = PRT
I = Interest
P = Principal (starting amount)
R = Interest rate (percentage)
T = Time in years.
Interest rate has to be a decimal number when it's being calculated. For example, if I had 5.4% interest, i'd have to plug it into a calculator as 0.054.
How can I change the output to put decimal places in so I dont have to have a user input it as a decimal?