利息计算器

#include <iostream>
using namespace std;
int main()
{
	int i;
	double a,b,f,d,c,g,r,o,p;
cout<<"请选择存款类型:定期存款请按1;活期存款请按2.";
cin>>a;
if (a==1)
{
	cout<<"请输入存款金额:"<<endl;
	cin>>b;
	cout<<"请输入存款期限,以年为单位"<<endl;
	cin>>f;
	d=0.1;
	c=b*d*f;
	cout<<"您的利息为:"<<c<<"元"<<endl;
}
else
	cout<<"请输入存款金额:"<<endl;
cin>>o;
cout<<"请输入您的存款期限,以月为单位:"<<endl;
cin>>g;
if (g=1)
	i=0;
else if (g=3)
	i=1;
else if (g=6)
	i=2;
else if (g=12)
	i=3;
else if (g=24)
	i=4;
else if (g=36)
	i=5;
else if (g=60)
	i=6;
switch (i)
{
case 0:r=0.005;break;
case 1:r=0.031;break;
case 2:r=0.033;break;
case 3:r=0.035;break;
case 4:r=0.044;break;
case 5:r=0.05;break;
case 6:r=0.055;break;
}
p=r*o*g;
cout<<"您的利息为:"<<p<<"元";
return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值