[example/index] Add flushing of std::cout per key pressed.