Can someone please help me? Okay if a principal amount is P, for which the interest is compounded Q times per year, is placed in a savings account, then the amount of money in the account (the balance) after N years is given by the following formula where I is the annual interest rate as a floating-point number:

balance = P x (1 + I/Q) to the (N x Q) power. I have to write a program that inputs the values for P, I, Q, and N and outputs the balance for each year up through year N that uses a value-returning function to compute the balance and also prompts the user. Here is my code so far. Can someone tell me if I'm taking the right route or what else I need to do.

// Algorithm

// (1) Get input value for principal amount

// (2) Get annual interest rate

// (3) Get amount of times per year interest rate is compounded

// (4) Get amount of years interest is to be compunded

// (5) Use a value returning function to compute the balance

// (6) Output values

#include <iostream>

#include <iomanip>

float P, I, Q, N;

int main()

{

cout.setf(ios::fixed,ios::floatfield);

cout.setf(ios::showpoint);

cout<<setprecision(2);

cout<<"Enter principal amount"<<endl;

cin>>P;

cout<<"Enter annual interest amount"<<endl;

cin>>I;

cout<<"Enter amount of times interest is compunded per year"<<endl;

cin>>Q;

cout<<"Enter amount of years interest is to be compunded"<<endl;

cin>>N;

return P * (1 + (I / Q)^(N * Q);

}