hello.
was wondering, first of all, is using multithreading a "beginner" problem?
anyhow, i'm trying to run two pieces of code together.
one code displaying how many days have passed(1day=1sec)
while the other is asking for user input
(what would you like you build?
1.barn
2.farm
3... etc.
)
the point is that the days keep passing by, not waiting for the user input.
after googling a bit i found that this operation is called multithreading.
as i could not find any decent and understandable tutorial online, I'm turning to you, my saviours, to maybe shed some light on this matter, or direct me to a good resource that i can learn from.
You can not use console to input and output concurrently.
Current standard of C++ doesn't care about multithreading(draft version of new one does).
But you can use third library like BOOST, TBB, OpenMP and others, or operating system specific functions.
link to TBB http://www.opentbb.org
link to boost http://www.boost.org
Threading is typically not a beginner question. There are lots of things you need to know before using threads, mostly dealing with thread synchronization and the sharing of data.
Threading is one way to accomplish this. You can use asynchronous IO (see the Boost Asio library) to do this which uses threads in the background. Or you can use poll or select (I assume windows has an equivalent) to wait for a limited amount of time for user input.