
Schedule Loan program?
Suppose I have three parameters  Original Principal = 500, terms(in months) = 12, and Interest rate = 8.25. I want write a function that produce the following below. For that monthly payment, I can code it.
For example. P = 500, i = (8.25/100)/12, and n = 12 (months).
monthlypayment = P [(i(1 + i)^n / ((1 + i)^n)  1]
43.55 = monthlypayment.
But what about Cumulative principal and cumulative interest rate? (Note: those aren't negative numbers, just  in front).
Month Total Principal Interest Cum Princ Cum Int
1 $43.55 $40.11 $3.44 $40.11 $3.44
2 $43.55 $40.39 $3.16 $80.50 $6.60
3 $43.55 $40.67 $2.88 $121.17 $9.48
4 $43.55 $40.95 $2.60 $162.12 $12.09
5 $43.55 $41.23 $2.32 $203.35 $14.41
6 $43.55 $41.51 $2.04 $244.86 $16.45
7 $43.55 $41.80 $1.75 $286.66 $18.20
8 $43.55 $42.09 $1.47 $328.75 $19.67
9 $43.55 $42.37 $1.18 $371.12 $20.85
10 $43.55 $42.67 $0.89 $413.79 $21.73
11 $43.55 $42.96 $0.59 $456.75 $22.33
12 $43.55 $43.25 $0.30 $500.00 $22.62
Above is an output from Excel, but I want to do the same in C++?

think about it this way: every time you have to remember a number, so does your program...
a cumulative variable is no different than any other variable.

1. Input your givenvariables.
2. Calculate the monthly payment using the formula. (One time only! Use the power function pow() from <cmath> )
3. Initialize the starting balance (the loan amount)
Initialize cumulative principal & comulative interest to zero.

4. Start loop. (Loop once each month)
5. Calculate the interest for this month's balance. (1/12th of the annual interest rate.)
Update cumulative interest.
6. Calculate the principalpaid, by subtracting the interest from the payment.
Update cumulative principal.
7. Calculate (and update) the next month's starting balance by subtracting the principalpaid from the starting balance.
8. Repeat loop.

EDIT 
Are you asking about this?
CumInterest = CumInterest + CurrentInterest // Update cumulative interest.
Although that's not a valid equation, it is a valid C/C++ assignment statement. The value of the expression (or value) on the right gets assigned to the variable on the left. (And, you can't switch it around like an equation... The variable being updated must be on the left side.)