本帖最後由 tony 於 2010-6-4 19:22 編輯
#include<iostream>
#include<cstdlib>
#include<math.h>
using namespace std;
int main(void){
float p ;
float r ;
int n ;
float t ;
cout << "enter your money" << endl;
cin >> p ;
cout << "enter your bonus" << endl;
cin >> r ;
cout << "enter your year" << endl;
cin >> n ;
int nn = n * 12 ;
if(r > 1){
float rr = r * 0.01 ;
cout << p * pow((1 + rr) , nn) << endl ;
}else if(r < 1){
cout << p * pow((1 + r) , nn) << endl ;
}
system("pause");
return 0 ;
} |