/*
Copyright (c) 烟台大学计算机与控制工程学院
Author:刘慧艳
Created:2014.07.16
Edition:V1.0
Describe:
*/
#include <iostream>
using namespace std;
int main()
{
int num;
double deposit,days,rate,interest,nud;
cout<<"****欢迎使用利息计算器****"<<endl;
cout<<"请输入存款金额:";
cin>>deposit;
cout<<"1.活期存款"<<endl;
cout<<"2.3个月"<<endl;
cout<<"3.6个月"<<endl;
cout<<"4.一年"<<endl;
cout<<"5.两年"<<endl;
cout<<"6.三年"<<endl;
cout<<"7.五年"<<endl;
cout<<"请选择存款期限:";
cin>>num;
if(num>=1&&num<=7)
{
switch(num)
{
case 1:
rate=0.005;
cout<<"请输入存款天数:";
cin>>days;
nud=days/360;
break;
case 2:
rate=0.031;
nud=0.25;
break;
case 3:
rate=0.033;
nud=0.5;
break;
case 4:
rate=0.035;
nud=1;
break;
case 5:
rate=0.044;
nud=2;
break;
case 6:
rate=0.05;
nud=3;
break;
case 7:
rate=0.055;
nud=5;
break;
}
interest=deposit*nud*rate;
cout<<"到期利息为:"<<interest<<endl;
cout<<"本息合计为:"<<interest+deposit<<endl;
}
else
{
cout<<"选择代号错误!请重新操作!"<<endl;
}
cout<<"感谢您的使用!欢迎再次光临!"<<endl;
return 0;
}
switch利息计算
最新推荐文章于 2022-12-25 14:02:16 发布