0
About ==
Why the output isn't "yes"?? #include <iostream> using namespace std; int main() { float z=0.1; if (z == 0.1) { cout << "Yes"; } else cout << z; return 0; }
1 ответ
+ 4
Because floating point literals are considered double by default.
Use 0.1f in your condition to make it pass the if clause.