fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. for (double i = -1.0; i <= 1.0; i += 0.1) {
  5. std::cout << i << " " << (bool)i << std::endl;
  6. }
  7.  
  8. return 0;
  9. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
-1 1
-0.9 1
-0.8 1
-0.7 1
-0.6 1
-0.5 1
-0.4 1
-0.3 1
-0.2 1
-0.1 1
-1.38778e-16 1
0.1 1
0.2 1
0.3 1
0.4 1
0.5 1
0.6 1
0.7 1
0.8 1
0.9 1
1 1