//Calculation of Compound Interest #include #include #include using namespace std; int main() { // The type "double" is a floating-point type much //like "float" but with greater precision. double amount, // amount on deposit principal = 1000.0,// starting principal rate = .05; // interest rate cout << "Year " << "Amount on deposit" << endl; for ( int year = 1; year <=10; year++ ) { // function "pow( x, y ) calculates the // value of "x" raised to the "yth" power. // This function requires "math.h" file. amount = principal * pow( 1.0 + rate, year ); cout << year << " " << amount << endl; } return 0; } ///////////////////////////////////////////////// // Answers to lab problem // 2% // 3% // 5% // 7% ////////////////////////////////////////////////