Difference between revisions of "Directory:Derek Elder/Programs/Interest Calculator"
MyWikiBiz, Author Your Legacy — Saturday September 06, 2025
Jump to navigationJump to searchDerek Elder (talk | contribs) (start of page) |
(No difference)
|
Latest revision as of 22:48, 1 November 2007
#include <iostream> #include <cmath> using namespace std; void main() { float deposit = 0.0; float rate = 0.0; float compound = 0.0; float years = 0.0; cout<<"Enter the initial deposit: "; cin>>deposit; cout<<"Enter the annual interest rate percent: "; cin>>rate; cout<<"Enter the number of times the compounding is done per year: "; cin>>compound; cout<<"Enter the number of years the deposit will be left to build interest: "; cin>>years; //(rate/100) Takes the rate and converts it from a percent to a fraction float accum = (1+((rate/100)/compound)); float exponent = years*compound; cout<<"The accumulation after "<<years<<" years is: "<<deposit*pow(accum,exponent)<<endl; }