C/C++ 银行存款N年本息和计算
2016-06-07 21:21
645 查看
/* 2015年11月29日15:35:22 银行存款本息和计算 */ #include<math.h> #include<stdio.h> float count(float m,float r,float y) { if(y==1) return m*(1+r);a else return count(m,r,y-1)*(1+r); } int main(void) { float money; //原始存款金额 float money_rate; //存款利率 float year; //存款年限 printf("Please enter the amount of money you want to deposit:"); scanf("%f",&money); printf("Please enter the money rate of the bank: "); scanf("%f",&money_rate); printf("Please enter how long to deposit:"); scanf("%f",&year); printf( "%f",money*( pow((1+money_rate),year) ) ); printf("After %d years,you can get: ",(int)year); printf("< %.2f > Yuan.\n",count(money,money_rate,year)); }
相关文章推荐
- C++ 笔记6:String 和 string stream
- Search a 2D Matrix II
- 长方体的体积和面积
- C/C++指针与数组的关系
- C/C++运算符重载实现字符串相加
- C/C++ 虚函数
- C/C++ 重载+运算符重载加号 实现矩阵相加
- C_basic_summary--各种类型数据所占字节数
- Sliding Window Maximum
- 温习C/C++宏定义
- VC++ 数字图像处理第二章学习
- C++ 笔记5:LIST 和MAP
- leetcode 20 Valid Parentheses C++
- C/C++卡布列克运算验证
- C++ STL中Map的按Key排序和按Value排序
- 武器类属性
- C++智能指针(auro_ptr...)
- C++智能指针(auro_ptr...)
- C++ 线程池实现原理
- Invert Binary Tree