Given an initial capital in euros, an annual interest rate (expressed in %), a time in years and an indication whether the interest is simple or compound, determine the amount of euros the initial capital is transformed into.
The input consists of two strictly positive real numbers
and
,
followed by a strictly positive integer
,
followed by either the word “simple” or the word
“compound”.
Write the final capital with 4 decimal places.
If you program in C++, use the double data type and put
these two lines at the beginning of your main():
cout.setf(ios::fixed);
cout.precision(4);
Input
1000 3 2 simple
Output
1060.0000
Input
1000 3 2 compound
Output
1060.9000
Input
1234.5 5.1 22 compound
Output
3687.6598