%f是但进度浮点数的格式双精度浮点数应用%lf,改一下就行了因为double是8个字节的,float是4个字节的,%f 的格式就是4个字节的,而 %lf 就是8个字节的
#include <stdio.h>#include <math.h>int main( void ){ double x; scanf("%lf",&x); //输入double型
float x;
scanf("%f", &x)
return 0;}
%f是但进度浮点数的格式双精度浮点数应用%lf,改一下就行了因为double是8个字节的,float是4个字节的,%f 的格式就是4个字节的,而 %lf 就是8个字节的
#include <stdio.h>#include <math.h>int main( void ){ double x; scanf("%lf",&x); //输入double型
float x;
scanf("%f", &x)
return 0;}