sacanf不能识别expf(1),你输入它等于输入0
你需要输入2.71828
#include <stdio.h>
#include <math.h>
int main()
{
double i;
scanf_s("%lf", &i);
double x = logf(i);
printf("%lf", x);
}
2.71828
0.999999Press any key to continue . . .
#include <stdio.h>
#include <math.h>
int main()
{
double x = logf(expf(1));
printf("%lf", x);
}
1.000000Press any key to continue . . .
数据没有正常被x读取到
改成这样会好一点
scanf("exp(%lf)",&x);