본문 바로가기

공부/프로그래밍

C++ 이자율을 통한 미래 금액 계산하기

#include  <iostream>
#include  <string>

using namespace std;
int main()
{
   float total_money;
   float money;
   float interest_rate;
   float deposit_years;

   money =10;
   interest_rate =0.1;
   deposit_years =10;
   total_money =money*interest_rate*deposit_years+money;
   cout << "total_money = "<< total_money << endl;
   cin>>total_money;
   return 0;
}

728x90