关于递归调用
![](zzz/editor/img/code.gif)
#include <iostream.h> int mihanshu(int a,int b) { int c; if(a==0) cout<<c<<endl ; else c=b*mihanshu(a-1,b); }想用它作为一个求幂函数的函数,怎么出错了
#include <iostream.h> int mihanshu(int a,int b) { int c; if(a==0) cout<<c<<endl ; else c=b*mihanshu(a-1,b); }想用它作为一个求幂函数的函数,怎么出错了
#include <iostream.h> int mihanshu(int a,int b) { int c=0; if(a==0) cout<<c<<endl ; else c=b*mihanshu(a-1,b); return c; } void main() { int a,b,c; cin>>a>>b; c=mihanshu(a,b); }上个问题解决了,单这个程序输入2 2,怎么输出是0啊?我
#include <iostream.h> int mihanshu(int a,int b) { int c=0; if(a==0) c = 1; else c=b * mihanshu(a-1,b); return c; } void main() { int a,b,c; cin>>a>>b; c=mihanshu(a,b); cout << c << endl; }