The main reason you are seeing flickering is that you are drawing individual characters as fast as std::cout will let you.
By default on windows, std::cout will buffer the characters you stream to it until you supply a newline. Because there are many newlines in each board, this means that the console will draw line by line. Once it is done drawing once, you immediately start drawing again. This will scroll the lines of the console, so there isn't a consistent position of the top and bottom rows. When your screen goes to draw, those borders will be in an arbitrary position.
I would check if you still have flicker if there is a wait-time between draws, as a modern computer should be able to update an entire console window in a fraction your screen's refresh time. Adding a wait of approximately the time between redraws of your screen (~16ms for a 60Hz screen) will (mostly) ensure that your bottom row will be the bottom of the console output when the screen is drawn.
#include <thread> int main(){ while(true){ auto next_frame = std::chrono::steady_clock::now() + std::chrono::milliseconds(16); board(); std::this_thread::sleep_until(next_frame); } return 0; }