Sei sulla pagina 1di 1

// Gage Snyder 1/26/14 This program will calculate the Interest and final balance given a principal !

include "iostream# !include "iomanip# !include "cmath# using namespace std$ int main%& ' double principal( // the initial balance rate( // the interest rate times( // the amount of times compounded finalbalance( // )inal balance assigned to from the interest formula interest$ // the amount of money that was compounded from the time cout "" showpoint "" setprecision%2& "" fi*ed$ // +ntering values for the interest formula cout "" ,-lease enter the interest rate. ,$ cin ## rate$ cout "" ,-lease enter the times compounded. ,$ cin ## times$ cout "" ,-lease enter the principal. ,$ cin ## principal$ // /alculating the interest using principal( the interest rate( and time compounded finalbalance 0 principal 1 pow%%1 2 %rate/times&&(times&$ // calculating the 3ust the interest from the final balance interest 0 finalbalance 4 principal$ // 5isplaying the results cout "" ,6nInterest 7ate. , "" setw%18& "" rate 1 199 "" , : , "" endl$ cout "" ,Times /ompounded. , "" setw%19& "" , ; , "" times "" endl$ cout "" ,-rincipal. , "" setw%18& "" , ; , "" principal "" endl$ cout "" ,Interest. , "" setw%1<& "" , ; , "" interest "" endl$ cout "" ,)inal =alance. , "" setw%1>& "" , ; , "" finalbalance "" endl$ cin ignore%&$cin ignore%&$ return 9$ ?

Potrebbero piacerti anche