C语言浮点数比较 C语言while循环语法要点 C语言真条件实例 C语言浮点数比较 // cmpflt.c -- floating-point comparisons #include <math.h> #include <stdio.h> int main(void) { const double ANSWER = 3.14159; double response; printf("What is the value of pi?\n"); scanf("%lf", &response); while (fabs(response - ANSWER) > 0.0001) { printf("Try again!\n"); scanf("%lf", &response); } printf("Close enough!\n"); return 0; } C语言while循环语法要点 C语言真条件实例