这里用到了 pow 函数,也包括了pow函数的头文件 #include <math.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int c=pow (a,b);
cout<<a<<"的"<<b<<"次方="<<c<<endl;
system("pause");
return 0;
}
如果输入的a b过大,a b 可能不在适合int 的范围