fork download
  1. #include <iostream>
  2.  
  3. enum class Hello {
  4. W,
  5. O,
  6. R,
  7. L,
  8. D
  9. };
  10.  
  11. std::ostream& operator<<(std::ostream& out, Hello h) {
  12. switch (h) {
  13. case Hello::W: return out << "W";
  14. case Hello::O: return out << "O";
  15. case Hello::R: return out << "R";
  16. case Hello::L: return out << "L";
  17. case Hello::D: return out << "D";
  18. }
  19. }
  20.  
  21. int main() {
  22. Hello const h = Hello::O;
  23. std::cout << h << "\n";
  24. return 0;
  25. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
O