看看 这个程序又是哪里出的问题?
#include <stdio.h>double power (int, int);
int main (void)
{
int count, zz;
double result;
printf ("请输入要处理的数:\n");
scanf ("%d", &count);
printf ("请输入它的指数:\n");
scanf ("%d", &zz);
result = power (count,zz);
printf ("%.3f为所求!");
}
double power (int count, int zz)
{
double result;
int i;
if (count == 0)
return 0;
if (zz == 0)
return 1;
if (zz > 0)
{
for (i = 0; i < zz-1; i++)
count *= count;
result = count;
}
else
{
for (i = 0; i< -zz-1; i++)
count *= count;
result = 1.0/count;
}
return result;
}