int main(int argc, _TCHAR* argv[])
{
double amount;
double rate;
int numPayments;
double payment = (rate * pow((1 + rate), numPayments) / (pow((1+rate),numPayments)-1)) * amount;
cout << "Loan amount: " << endl;
cin >> amount;
cout << "Monthly interest rate (.12 for 12%): " << endl;
cin >> rate;
cout << "Number of monthly payments to be made: " << endl;
cin >> numPayments;
cout << "Loan amount: " << amount << endl;
cout << "Monthly interest rate: " << rate << endl;
cout << "Number of Payments: " << numPayments << endl;
cout << "Monthly payment: " << (amount/numPayments)*rate;
cout << "Amount paid back: " << (amount*rate)+amount;
cout << "Interest paid: " << amount*rate;
}
嗨,我正在尝试编写一个相当简单的利息计算程序……不断得到“使用的初始化局部变量”。我对 C++ 很陌生,所以我确信这很简单......