I keep getting this error in my code. I believe it is because to use pow(x,y) both x and y have to be double, but how do i put that into my formula under calculations?
int main()
{
// Declaration section: Declaring all variables.
string loan_type, Auto;
double loan_amt, annual_rate, monthly_payment, monthly_rate, total_amt, interest_paid, number_of_payments, number_of_years;
ofstream outfile;
// Input Section: User gives the program the information needed to create report
cout << "Enter your type of loan <Auto, Home>: ";
cin>> loan_type;
// If loan is an auto loan
if (loan_type == "Auto")
{
cout << "Amount to borrow: ";
cin>> loan_amt;
cout << "How many payments <36, 48, 60>: ";
cin>> number_of_payments;
}
//Else is if it is a home loan
else
{
cout << "Amount to borrow: ";
cin>> loan_amt;
cout << "How many years <15, 20, 30>: ";
cin>> number_of_years;
}
if (number_of_payments == 36)
{
annual_rate=0.06940;
}
else if (number_of_payments == 48)
{
annual_rate=0.07010;
}
else if (number_of_payments == 60)
{
annual_rate=0.08050;
}
// If the nummber of years is 15, 20, or 30 then the number of payments is 180, 240, or 360 and their interest rates
if (number_of_years == 15)
{
number_of_payments=15*12;
annual_rate=0.03750;
}
else if (number_of_years == 20)
{
number_of_payments=20*12;
annual_rate=0.04125;
}
else if (number_of_years == 30)
{
number_of_payments=30*12;
annual_rate=0.05250;
}
// Finding monthly interest rate for different annual rates
if (annual_rate == 0.06940)
{
monthly_rate=annual_rate/12;
}
else if (annual_rate == 0.07010)
{
monthly_rate=annual_rate/12;
}
else if (annual_rate == 0.08050)
{
monthly_rate=annual_rate/12;
}
else if (annual_rate == 0.03750)
{
monthly_rate=annual_rate/12;
}
else if (annual_rate == 0.04125)
{
monthly_rate=annual_rate/12;
}
else if (annual_rate == 0.05250)
{
monthly_rate=annual_rate/12;
}