求c++大神帮我看看编的程序哪错了....
#include<iostream>usingnamespacestd;intmain(){intannualInterestRate;cout<<"Enteraannu...
#include <iostream>
using namespace std;
int main()
{
int annualInterestRate;
cout<<"Enter a annualInterestRate :" ;
cin>>annualInterestRate;
const int deposit = 100;
double monthlyInterestRate = annualInterestRate / 1200;
double FirstMonth = deposit * (1 + monthlyInterestRate );
double SecondMonth = (deposit + FirstMonth) * (1 + monthlyInterestRate);
double ThirdMonth = (deposit + SecondMonth) * (1 + monthlyInterestRate);
double FourMonth = (deposit + ThirdMonth) * (1 + monthlyInterestRate);
double FifthMonth = (deposit + FourMonth) * (1 + monthlyInterestRate);
double SixthMonth = (deposit + FifthMonth) * (1 + monthlyInterestRate);
cout <<"The FirstMonth is : "<<FirstMonth
<<"\n The SecondMonth is : "<<SecondMonth
<<"\n The ThirdMonth is : "<<ThirdMonth
<<"\n The FourthMonth is : "<<FourMonth
<<"\n The FifthMonth is : "<<FifthMonth
<<"\n The SixMonth is : "<<SixthMonth<<endl;
return 0 ;
}
程序中想表达的意思,是下一个月和上个月累加,可是输出结果却是
100
200
300
400
500
600.。。
求大神给我,书上没写的特别清楚,自学的孩子,求照顾哦(*^__^*) 展开
using namespace std;
int main()
{
int annualInterestRate;
cout<<"Enter a annualInterestRate :" ;
cin>>annualInterestRate;
const int deposit = 100;
double monthlyInterestRate = annualInterestRate / 1200;
double FirstMonth = deposit * (1 + monthlyInterestRate );
double SecondMonth = (deposit + FirstMonth) * (1 + monthlyInterestRate);
double ThirdMonth = (deposit + SecondMonth) * (1 + monthlyInterestRate);
double FourMonth = (deposit + ThirdMonth) * (1 + monthlyInterestRate);
double FifthMonth = (deposit + FourMonth) * (1 + monthlyInterestRate);
double SixthMonth = (deposit + FifthMonth) * (1 + monthlyInterestRate);
cout <<"The FirstMonth is : "<<FirstMonth
<<"\n The SecondMonth is : "<<SecondMonth
<<"\n The ThirdMonth is : "<<ThirdMonth
<<"\n The FourthMonth is : "<<FourMonth
<<"\n The FifthMonth is : "<<FifthMonth
<<"\n The SixMonth is : "<<SixthMonth<<endl;
return 0 ;
}
程序中想表达的意思,是下一个月和上个月累加,可是输出结果却是
100
200
300
400
500
600.。。
求大神给我,书上没写的特别清楚,自学的孩子,求照顾哦(*^__^*) 展开
展开全部
你在程序中加上上个月的就可以了啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询