返回列表 發帖
  1. //t = p * (1 + r)^n
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <math.h>
  5. using namespace std;
  6. int main(void){

  7.    
  8.     float p , r;
  9.     int n;
  10.     cout << "請輸入本金" << endl;
  11.     cin >> p;
  12.     cout << "請輸入月利率" << endl;
  13.     cin >> r;
  14.     cout << "請輸入存款期數" << endl;
  15.     cin >> n;
  16.     cout << "本利和為 " << p * pow((r+1) , n) << endl;
  17.    

  18.     system("pause");
  19.     return 0;
  20. }
複製代碼
明輝

TOP

返回列表