A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-106.cpp
1#include<iostream>
2#include<string>
3intmain(){
4std::strings="hi";
5s+=33;
6std::cout<<s<<"\n";
7return0;
8}
Conversions
Answer & explanation
Console output
hi!
Why
std::string::operator+=(char) is selected and the int 33 is converted to a char with code 33, which is the ! character. So appending 33 adds a single ! rather than the text "33", producing "hi!". The integer-to-char conversion picks the glyph at that code point.