c++ 计算银行存款的本息?谁能帮我编一下程序,谢谢了!
计算银行存款的本息.输入存款金额money、存期year、和年利率rate,根据下列公式计算存款到期时的本息合计sum。Sum=money(1+rate)year[注:y...
计算银行存款的本息.输入存款金额money、存期year、和年利率rate,根据下列公式计算存款到期时的本息合计sum。
Sum=money(1+rate)year [注:year为平方,在这里不好打]
我是初学者,用最简单的语句编写就可以了。谢谢大家!
是C++,不是C语言! 展开
Sum=money(1+rate)year [注:year为平方,在这里不好打]
我是初学者,用最简单的语句编写就可以了。谢谢大家!
是C++,不是C语言! 展开
展开全部
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
int year;
double money,rate,sum=0;
cout<<"Please enter money:";
cin>>money;
cout<<"\nPlease enter rate:";
cin>>rate;
cout<嫌尘<"\歼者友nPlease enter year:";
cin>>year;
sum=money*(1+pow(money,1+rate));//计算sum
cout<<"\氏槐nThe Sum is:"<<
fixed<<setprecision(5)<<sum<<endl;
system("pause");
return 0;
}
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
int year;
double money,rate,sum=0;
cout<<"Please enter money:";
cin>>money;
cout<<"\nPlease enter rate:";
cin>>rate;
cout<嫌尘<"\歼者友nPlease enter year:";
cin>>year;
sum=money*(1+pow(money,1+rate));//计算sum
cout<<"\氏槐nThe Sum is:"<<
fixed<<setprecision(5)<<sum<<endl;
system("pause");
return 0;
}
展开全部
/*把你的计算本息和的公式用c语言分解了薯烂*/
#include"stdio.h"
main()
{
int money,year,i;
float rate,sum;
printf("氏手坦input money and year:\n");
scanf("%d%d",&money,&year);
printf("input rate:\n");
scanf("%f",&rate);
sum=money;
for(i=0;i<歼桐year;i++)
sum*=(1+rate);
printf("ben xi he :%f\n",sum);
}
#include"stdio.h"
main()
{
int money,year,i;
float rate,sum;
printf("氏手坦input money and year:\n");
scanf("%d%d",&money,&year);
printf("input rate:\n");
scanf("%f",&rate);
sum=money;
for(i=0;i<歼桐year;i++)
sum*=(1+rate);
printf("ben xi he :%f\n",sum);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询