我在使用 pow 函数时遇到问题。该方程是A=P*((1+R)/T)^T“^”的幂。我将如何使用 pow 函数,我只看到 4 到 5 次方的示例,与我必须做的完全不同
//Samuel LaManna
//Program 1 (intrest rate)
/*Variables:
Principal=P
Interest Rate=R
Times Compounded=T
Answer=A */
#include <iostream> //Input/output
using namespace std;
int main ()
{
int P, R, T, A; //Declaring Variables
cout<<endl;
cout<<"Interest Earned Calculator"; //Prints program title
cout<<endl;
cout<<endl;
cout<<"Please enter the Principal Value: ";
cin >> P;
cout<<endl;
cout<<endl;
cout<<"Please enter the Interest Rate (in decimal form): ";
cin >> R;
cout<<endl;
cout<<endl;
cout<<"Please enter the Number of times the interest is compounded in a year: ";
cin …Run Code Online (Sandbox Code Playgroud)