← Back to archive

Stdle #88 · conversions · 2026-09-02

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
int main() {
std::cout << std::boolalpha;
std::cout << static_cast<bool>(-0.0) << "\n";
std::cout << static_cast<bool>(0.5) << "\n";
return 0;
}
Conversions
2 lines
4 attempts left

Answer & explanation