[C++] Multitasking Help

I have hit a snag with C++.

What I’m trying to do is have a user input box, but while waiting for the user to input text, I want to run a function every 3 seconds or so. The problem is that the program gets to the getline() and it just stops executing until the user hits enter.

How can I get around this? (As you can probably tell, I’m fairly new to C++)