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; }

9th Feb 2019, 7:46 PM
Белка которая держит цветок
Белка которая держит цветок - avatar
1 Answer
+ 4
Because floating point literals are considered double by default. Use 0.1f in your condition to make it pass the if clause.
9th Feb 2019, 7:56 PM
Jomari Pantorilla
Jomari Pantorilla - avatar