Please Scroll Down to See Forums Below
napsgear
genezapharmateuticals
domestic-supply
puritysourcelabs
UGL OZ
UGFREAK
napsgeargenezapharmateuticals domestic-supplypuritysourcelabsUGL OZUGFREAK

C++ and Math Experts... need help

Honey Roasted said:
I know the formulas...

Let

L = amount of loan
i = monthly interest rate (so assume the APR has been divided by 12 already)
n = number of payments
R = amount of each level payment

Then

R = L * i / (1 - v^n)
where v = 1/(1+i)

total amount of all payments = n * R
total interest paid = n * R - L


I will try it this way... one question... what is the "^" part of the formula? What math operand is this to be included?
 
AAP said:



I will try it this way... one question... what is the "^" part of the formula? What math operand is this to be included?

^ is the sign that the next number is a exponent.
 
AAP said:


Ok, one last request.... this was great info... can you plug the numbers in there and post a sample string?

C++ coders be gentle...this is the first C++ code I've written in a long time. This should get him going - it spit out the right values when I ran it:




// mathcons.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "math.h"

int main(int argc, char* argv[])
{


// Loan Amount: $ 10000.00
// Monthly Interest Rate 1%
// Number of Payments 36
// Monthly Payment 332.14
// Amount Paid Back 11957.15
// Interest Paid 1957.15
// Payment = Rate * (1 + Rate)N / ((1 + Rate)N -1) * L

double Loan;
double Interest;
double NumPayments;
double PaidBack;
double InterestPaid;
double Payment;

Loan = 10000;
Interest = .01;
NumPayments = 36;


Payment = Interest * pow(1 + Interest,NumPayments) / (pow(1 + Interest,NumPayments) -1) * Loan;
PaidBack = NumPayments * Payment;
InterestPaid = PaidBack - Loan;

printf("Payment \t%f",Payment);
printf("\n");
printf("Interest Paid \t%f",InterestPaid);
printf("\n");
printf("Amount Paid \t%f",PaidBack);

return 0;
}

 
Last edited:
in case ya missed it, the pow function is for raising something to a power i.e., pow (3,2) = 9
 
jnuts said:
in case ya missed it, the pow function is for raising something to a power i.e., pow (3,2) = 9



that is the prob right there..... the pow function. I simply could not figure out how to get the powers raised. Ok, get this... he is doing the problem for Chapter 3. There was NO pow function in Ch 3. They started that in Ch 4.
 
i might have this project saved on my computer.

we had to do the same thing freshmen year. let me look.
 
p0ink said:
i might have this project saved on my computer.

we had to do the same thing freshmen year. let me look.


If you do, do you have the rest of them saved as well?
 
Top Bottom