void main() { //定义fun函数 double fun(int x, int y); int x, y; double z; printf("请分别输入x,y的值:"); scanf("%d %d",&x,&y); z = fun(x,y); //调用函数 printf("%d的%d次方 = %lf\n",x,y,z); } double fun(int x, int y) { double pow(double x, double y); double m = 0; m = pow(x,y); //求次方函数 return m; }
运行结果如下: