主题:为什么运行不了,哪出错了?
#include<iostream>
#include<cmath>
int main()
{
unsigned long loanAmount=150000;
float annualInterestRate=6.0;
unsigned short loanLength=30;
const unsigned short MONTHS_IN_YEAR=12;
float monthlyInterestRate=annualInterestRate/MONTHS_IN_YEAR;
monthlyInterestRate=monthlyInterestRate/100;
unsigned short numberPayments=loanLength*MONTHS_IN_YEAR;
float monthlyPayment=1-pow((1+monthlyInterestRate),-numberPayments);
monthlyPayment=monthlyInterestRate/monthPayment;
monthlyPayment=loanAmount*monthlyPayment;
std::cout<<"Assuming a loanin the amount of $"<<loanAmount<<",at"<<annualInterestRate
<<"% interdet,over"<<loanLength<<"yeats,the monthly payment would be $";
std::cout.setf(std::ios_base::fixed);
std::cout.setf(std::ios_base::showpoint);
std::cout.precision(2);
std::cout<<monthlyPayment<<".\n";
std::cout<<"press Enter or return to continue";
std::cin.get();
return 0;
}
#include<cmath>
int main()
{
unsigned long loanAmount=150000;
float annualInterestRate=6.0;
unsigned short loanLength=30;
const unsigned short MONTHS_IN_YEAR=12;
float monthlyInterestRate=annualInterestRate/MONTHS_IN_YEAR;
monthlyInterestRate=monthlyInterestRate/100;
unsigned short numberPayments=loanLength*MONTHS_IN_YEAR;
float monthlyPayment=1-pow((1+monthlyInterestRate),-numberPayments);
monthlyPayment=monthlyInterestRate/monthPayment;
monthlyPayment=loanAmount*monthlyPayment;
std::cout<<"Assuming a loanin the amount of $"<<loanAmount<<",at"<<annualInterestRate
<<"% interdet,over"<<loanLength<<"yeats,the monthly payment would be $";
std::cout.setf(std::ios_base::fixed);
std::cout.setf(std::ios_base::showpoint);
std::cout.precision(2);
std::cout<<monthlyPayment<<".\n";
std::cout<<"press Enter or return to continue";
std::cin.get();
return 0;
}
我是刚开始学c++,各位帮我看看哪出问题了,谢谢了