Answer:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
 int a=1;
 while(a==1){
 float P=0.0,R=0.0,T=0.0,A=0.0,n=0.0,nt=0.0;
 cout<<"Enter your Initial Investment Amount : ";
 cin>>P;
 cout<<"Enter your Rate of Annual interest : "; Â
 cin>>R;
 cout<<"Enter No. of times the interest is compound : " ;
 cin>>n;
 cout<<"Enter Time (years) : ";
 cin>>T;
 nt=n*T;
 A=P*pow((1+R/n),(nt));
 cout<<"After "<<T<<" years, the initial investment of "<<P<<" is : "<<A;
 cout<<"\nEnter 1 to continue or exit by pressing any other button";
 cin>>a;
}
 return 0;
}
Explanation: