[C ++] is calculated deposit principal and interest

Users enter the amount of the deposit money, savings and life years per annum rate, calculate the principal and interest on bank deposits

#include<iostream>
#include<cmath> //使用pow函数 
using namespace std;
int main() 
{
	double money,years,rate,sum;
	cin>>money>>years>>rate;
	sum=money*pow(1+rate,years);
	cout<<sum<<endl;
	return 0;
}

 

Guess you like

Origin blog.csdn.net/TOMOCAT/article/details/89606327