How to print increments vertically

I'm stuck at this part of the program where I have to print the principal vertically and its rates as shown in this output. My program's output only prints out the inputted principal and its rates. What do I use to increase the increments vertically and print the rates?
Principal Interest Rate
0.070 0.075 0.080 0.085 0.090 0.095 0.100
_______________________________________________________________________________

100000 665.30 699.21 733.76 768.91 804.62 840.85 877.57
200000 1330.60 1398.43 1467.53 1537.83 1609.24 1681.71 1755.14
300000 1995.90 2097.64 2201.29 2306.74 2413.86 2522.56 2632.72
400000 2661.20 2796.86 2935.06 3075.66 3218.49 3363.42 3510.29
500000 3326.50 3496.07 3668.82 3844.57 4023.11 4204.27 4387.86
600000 3991.80 4195.28 4402.59 4613.49 4827.73 5045.12 5265.43
700000 4657.10 4894.50 5136.35 5382.40 5632.35 5885.98 6143.00
800000 5322.41 5593.71 5870.12 6151.31 6436.97 6726.83 7020.58
900000 5987.71 6292.92 6603.88 6920.23 7241.59 7567.69 7898.15
1000000 6653.01 6992.14 7337.65 7689.14 8046.22 8408.54 8775.72
_______________________________________________________________________________
This is what the completed program should output

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    double principal, interestRate, monthlyPayment, numYears;
    monthlyPayment=(principal *(interestRate/12)* pow((1+(interestRate/12)),(numYears*12)))/(pow((1+(interestRate/12)),(numYears*12))-1);
    numYears= 30;
    cout << "This is a monthly payments program.\n\n";
    cout << "Enter the loan amount: $"; // enter 100,000 here
    cin >> principal;
    cout << "Principal\tInterest Rate"<< endl;
    cout << endl;
    for (interestRate =0.07; interestRate<=0.101; interestRate= interestRate+ 0.005)
    {
        cout <<"\t"<<interestRate;
    }
    cout <<endl;
    cout <<"____________________________________________________"<< endl;
    cout << principal;
    for (interestRate =0.07; interestRate<=0.101; interestRate= interestRate+ 0.005)
    {
        monthlyPayment=(principal *(interestRate/12)* pow((1+(interestRate/12)),(numYears*12)))/(pow((1+(interestRate/12)),(numYears*12))-1);
        cout << "\t"<< monthlyPayment;
    }
    cout << endl;
    cout <<"____________________________________________________"<< endl;
    cout <<"__"<< endl;
    cout<<"Interest rate is greater than 0.10 and the value is "<<interestRate<<endl;
    cout<<endl;
    cout<<" \n\t PROGRAM IS COMPLETE"<<endl;

    return 0;
}

This is a monthly payments program.

Enter the loan amount: $100000
Principal       Interest Rate

        0.07    0.075   0.08    0.085   0.09    0.095   0.1
____________________________________________________
100000  665.302 699.215 733.765 768.913 804.623 840.854 877.572
____________________________________________________
__
Interest rate is greater than 0.10 and the value is 0.105


         PROGRAM IS COMPLETE

Process returned 0 (0x0)   execution time : 2.847 s
Press any key to continue.
Last edited on
The loop on line 22 should be encompassed with another loop whose index is used to multiply the results of the inner loop and cout << endl;.
Topic archived. No new replies allowed.