小编Ash*_*ave的帖子

浮点比较`a!= 0.7`

可能重复:
浮点比较中的问题

#include <stdio.h>
#include <conio.h>

main()
{
    float a = 0.7;
    if(a < 0.7)
        printf("C");
    else
        printf("C++");
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,输出是C.我在Code :: Blocks和Pelles C中尝试了这个代码,但得到了相同的答案.我想详细了解这个的原因!

c floating-point comparison

4
推荐指数
2
解决办法
6439
查看次数

标签 统计

c ×1

comparison ×1

floating-point ×1