#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char *argv[])
{
double amount, rate, time, interest, month;
interest = rate/(12.0*100);
month = (amount * rate)/1.0 -(1.0 + interest), pow(time*12);
cout << "What is the amount of the loan? $ ";
cin >> amount;
cout << "What is the annual percentage rate? ";
cin >> rate;
cout << "How many years will you take to pay back the loan? ";
cin >> time;
cout <<"\n-------------------------------------------------------\n";
cout << "Amount Annual % Interest Years Monthly Payment\n\n\n";
cout <<amount <<" " <<rate <<" " <<time << " " <<month;
cout <<"\n\n";
system("PAUSE");
return EXIT_SUCCESS;
}
ここでエラーが発生し、 pow 関数を正しく使用する方法が正確にわかりません。問題に応じた式は次のとおりです。
Monthly payment = (loan amount)(monthly interest rate) / 1.0 - (1.0 + Monthly interest rate)^-(number of months)
これが私が問題を抱えている行です
month = (金額 * レート)/1.0 -(1.0 + 金利), pow(時間*12);
助けてくれてありがとう