帮忙看看哪里不对!!!
写一个求x的n次方的函数#include <iostream.h>
double cf(double x,int n)
{
double b=1;
for(int a=1;a<=n;a++)
{
b=b*a;
return b;
}
}
void main()
{
double x;int n;
cout<<"请输入X和N的值"<<endl;
cin>>x>>n;
cout<<x<<"的"<<n<<"次方为:"<<cf(x,n)<<endl;
}