c++编程:错误在哪

来源:百度知道 编辑:UC知道 时间:2024/07/04 09:21:58
下面是求a的b次方,运用函数的调用。编译和链接都没错,但运行不出来
(运行的页面什么都没有)。
请问:那里出错了,请指出来并写出结果(我用的是c++编程)

#include "stdafx.h"
#include "iostream.h"
#include "math.h"
double fun(int n)
{

double s=0,a,b,i;
cin>>a>>b;
for(i=1;i<=n;)
s= pow(a,b) ;
return fun(s);
}
void main()
{
double m,s;
m=s;
cin>>m;
cout<<fun(m);

}

#include "stdafx.h"
#include "iostream.h"
#include "math.h"
double fun()
{

double s=0,a,b;
cin>>a>>b;
s= pow(a,b) ; //这个函数就是求a的b次方,不用循环
return s;
}
void main()
{
cout<<fun();
gerchar();

}