Displaying a table computing compound CD value ?

Morning, everyone ! I'm writing another code for my class, and I seem to be stuck. Everything runs perfectly, I'm just not entirely sure how to get the code to display the compounded values. It will only compute the value after one month, however, let's say I wanted to compute the value after a year, I need to output a table that shows the value after each month within that year, and I'm stumped as to how to do that ?? Thanks in advance for your help !!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
using namespace std;


int main()
{

    
    double deposit, percentage;
    int maturity;
    
    //Simple header.
    cout << "COMPUTING CD VALUE" << endl;
    cout << "******************" << endl;
    //Promt user for initial value.
    cout << "Enter the initial deposit amount: ";
    cin >> deposit;
    //Prompt user for percentage yield.
    cout << "Enter the annual percentage yield: ";
    cin >> percentage;
    //Prompt user for maturity period.
    cout << "Enter maturity period (in months): ";
    cin >> maturity;

    float value = deposit + deposit * percentage / 1200;
    
    //Display value after maturity period has been reached.
    cout << value;
    
   
    return 0;
}
Use a loop.
Well that much I know, but how do I code it so that the value actually compounds ? I don't want it to just spit out the same value repeatedly.
Topic archived. No new replies allowed.