我有问题,但找不到任何解决方法。
它会显示相同的错误:
Pow:对重载函数的调用不明确
#include <stdio.h>
#include <math.h>
int main()
{
int a, i, n, product, result=1;
printf("enter a number\n");
scanf("%d", &a);
printf("enter n number\n");
scanf("%d", &n);
for(i = 1; i < n; i++) {
product = pow(a, i);
result *= product;
}
printf("the result is %d", result);
return 0;
}
result=1
,否则它会使用垃圾值。 - Punit Vara<tgmath.h>
。我同意这肯定是在C代码上使用C++编译器的OP。在使用pow()
并过滤C
时遇到问题的用户将无法找到该重复项,因为它是另一种语言。 C中的候选解决方案与C ++不同,因此我仍然断言所声称的重复项是一个糟糕的候选项。 - chux - Reinstate Monica