Mar 23, 2017 at 3:13am UTC
#include <cmath>
#include<iostream>
#include<iomanip>
using namespace std;
void inputFunction();
void calculateFunction();
int main()
{
inputFunction();
return 0;
}
void inputFunction(double principal, double rate, double term)
{
//get data from user
cout << "Enter your principal " << endl;
cin >> principal;
cout << "Enter your rate " << endl;
cin >> rate;
cout << "Enter your term" << endl;
cin >> term;
calculateFunction();
}
void calculateFunction(double principal, double rate, double term, double monthlyPayment)
{
//calculations
rate = rate / 1200.0;
term = term * 12;
monthlyPayment = principal*rate / (1.0 - pow(rate + 1, -term));
//print the output
cout << "Your monthlyPayment is " << setprecision(2) << monthlyPayment << endl;
}
that's my program, but at the beginning of the function it shows overload +1
just a beginner,and I have no idea how to fix it.
Any suggestion would be nice,thanks!
Mar 23, 2017 at 3:27am UTC
@winonav
You are calling the functions with no parameters, but your functions are expecting data.
In main(), you have..
BUT the function is ..
void inputFunction(double principal, double rate, double term)
You haven't passed any of the variables it's expecting.
Same goes for your
void calculateFunction(double principal, double rate, double term, double monthlyPayment)
Last edited on Mar 23, 2017 at 3:27am UTC
Mar 23, 2017 at 4:17am UTC
@whitenite1
But I need get parameters from user, right?
How should I put the parameters after the function call.