Quote (m0hawk @ Feb 19 2014 02:09pm)
for user input, please see this
http://www.cplusplus.com/forum/articles/6046/ , it shows you how to get user input as a string and then converting it to a number type. You just repeat this for P, r and T.
You don't need to create separate functions, just create one function that takes P, r and T as arguments, so you can compute A for any T value.
Hope this helped

/e can show actual code if you really can't manage it
Please don't listen to this guy you are doing it the correct way.
Quote (PiK @ Feb 19 2014 03:48am)
How do I create a formula that will allow the user to input P and R and then allow me to choose for certain T values?
Do I create seperate functions for each T-Value. Not sure how to just change T given the amounts they input and get the values.
Depends, you can submit to the function 8 times, each time hardcoding the time variable in ex:
Code
function(a, b, 1);
function(a, b, 5);
...
Or you can also create an array of time and loop through them
Code
int years[1, 5, 10, 20, 30, 50, 75, 100];
for(int i = 0; i < years.length(); i++) {
function(a, b, years[i]);
}
If you can find a mathematical correlation between those numbers, say that they are all n*10 (10, 20, 30, 40, 50) you could also do
Code
for(int i = 0; i < 100; i*10) {
function(a, b, i);
}
Although this will be harder with data sets that don't have a clear pattern.
If you are comfortable with arrays, I'd just input all your dates and loop through them. Simplest and cleanest way.
As for your formula you just need to create a function that accepts three(or more) variables.
Code
double getInterest(double primitive, double rate, double time){
//use these three variables to calculate your math
return interest;
}
Maybe I am not understanding, but I don't think you need the quad formula, you can simply do
Code
double interest = pow(princible * 2.718), rate * years);
Just woke up so I may be wrong.
This post was edited by AbDuCt on Feb 19 2014 02:46pm