Guest_imported
New member
- Jan 1, 1970
- 0
Does anyone know how to write an algebra formula in c++. The formula is K=H(i/(1-(1+i)^-t). I been trying for hours and no luck yet it.
Thanx
Thanx
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
double K, H;
int i, t;
// Somewhere you need to get i, k, and H.
// I'll assume that you've done that here
.
.
.
double Holdi = (double)i; // Put i to a float
// I'm breaking this out into parts starting with inner ()
i++; // (1+i)
// This loop creates i^t
for (int x = 0; x < t; x++)
i*=i; // i=i*i;
double HoldExp = (double)1/i; // My math is fuzzy here. i^-t
double HoldMinus = 1-HoldExp; // 1 - (1+i)^-t)
Holdi /= HoldMinus; // i/(1-(1+i)^-t)
K = H / Holdi; // Solution