Moved switch counter logic to separate function executed on its own thread while main (thread) waits for user to press enter on std::cin