标签:
#include <iostream>
#include <cmath> /// 数学函数必不可少.
using namespace std;
int main()
{
double a,x; /// a为底数,x为幂
while(cin>>a>>x)
{
cout<<pow(a,x)<<endl; /// 注意若求一个数的小数次方,则x一定要加小数点。
}
}
在定义a,x的类型时,最好定义为double型,以免发生错误。
标签:
原文地址:http://www.cnblogs.com/-beyond/p/5093513.html