printf不支持%lf

 1 #include <stdio.h>
 2 
 3 int square137(int n);
 4 
 5 void p137() {
 6     double x = 3.0;
 7     int y = (int)x;
 8     printf("Square of %f is %d
", x, square137(y));
 9 }
10 
11 int square137(int n) {
12     return n * n;
13 }

如果你吧%f改为%lf的话,输出就会出乎你的意料,试试便知

原文地址:https://www.cnblogs.com/qrlozte/p/4010290.html