且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Turbo C编译器问题,sqrt()函数无法使用变量参数

更新时间:2022-04-11 05:59:02

对于scanf()%f用于float.您需要将%lf用于double:

For scanf(), %f is for float. You need to use %lf for double:

printf("Enter a # for square root.\n");
scanf("%lf",&a);

这与printf()相反,在printf()中,类型促销允许%f用于floatdouble.

This is in contrast to printf() where type-promotion allows %f to be used for both float and double.