为什么输入"2,3"以后输出为0(注意:没输入引号)逗号也是英文半角
问题补充:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int a;
double b,c;
scanf("%f,%d",&b,&a);
c=pow(b,a);
printf("%f",c);
system("pause");
return 0;
}
最佳答案
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
int a, b;
double c; /*b定义为int*/
scanf("%d,%d",&b,&a);/*改成%d*/
c=pow(b,a);
printf("%f",c);
system("pause");
return 0;
}
这样运行,结果为8.000000
最佳答案由网友 aasdasd1 提供
其他回答
其它网友回答:
你的问题很简单,定义什么都不用改
其它网友回答:
只要改你的两个%f为%lf就可以得到正确的结果为
其它网友回答:
%f是输入/输出float的,而double要用%lf
其它网友回答: