#include<iostream> using namespace std; int main() { double r,m,y; cout << "***** 复利计算器 ****"<< endl; cout << "银行年利率:(%)" ; cin >> r; cout << "\r\n资金数额(万元):"; cin >> m; m=m*10000; int m2=m; cout << "\r\n存入年数(年):"; cin >> y; for(int i=0;i<y;i++) { m2=m2*(1+r/100); } cout<< "\r\n\r\n利息小计:" << (int)m2-m <<"元"; cout<< "\r\n本息合计:" << (int)m2 << "元" << endl; return 0; }
借鉴了网上他人的案例,虽然内容简单,但比较实用。
标签:范例,cout,int,复利,存款,计算器 From: https://www.cnblogs.com/RicL/p/16646033.html