0
我正在爲我的課製作抵押計算器,程序運行但答案不正確,我想我有正確的公式,但也許我宣佈我的變量是錯誤的。抵押貸款計算器公式不正確
這是我迄今爲止
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
//Variables
double rate;
rate = rate/1200.0;
double term;
term = term * 12;
double principal;
double monthlyPayment;
monthlyPayment = (principal * rate)/(1.0 - pow(rate + 1, -term));
//Gathering Values
cout << "Please enter your interest rate." << endl;
cin >> rate;
cout << "Please enter your term." << endl;
cin >> term;
cout << "please enter your principal" << endl;
cin >> principal;
//Formula
monthlyPayment = principal * rate/(1.0 - pow(rate + 1, -term));
//Result
cout << "Your monthly payment is, " << monthlyPayment << endl;
return 0;
}
工作感謝你!仍然不習慣於我所有的代碼需要考慮的因素,非常感謝您的幫助! –