I'm trying to make an interest rate calculator. And I keep getting this on these lines
rate >> Annualr / 12.0;
payment >> (rate * pow((1 + rate), paymentnumber) / pow((1 + rate), paymentnumber) - 1)*loan;
The large equation is supposed to calculate the amount of interest accrued on a loan
"illegal, left operand has type 'double'"
"illegal, right operand has type 'double'"
#include
<iostream>
#include
<string>
#include
<cmath>
#include
<iomanip>
using namespace std; void main() { double Annualr = 0.0, loan = 0.0, payment = 0.0, rate = 0.0; int paymentnumber = 0; string fullname; cout
<< "Enter the full loan ammount: "; cin>> loan; cout
<< "Enter the Annual interest rate: "; cin>> Annualr; cout
<< "How many payments have you made? "; cin>> paymentnumber; rate >> Annualr / 12; payment >> (rate * pow((1 + rate), paymentnumber) / pow((1 + rate), paymentnumber) - 1)*loan; cout
<< "Loan Ammount: " << loan << endl; cout << "Monthly Interest Rate: " << rate << endl; cout <<
"Number of Payments: " << paymentnumber << endl; cout << "Monthly Payment: " << payment << endl; cout << "Ammount paied back: " << payment * paymentnumber << endl; cout << "Interestt paied: " << loan - (payment * paymentnumber) << endl; system( "pause"); }