How can I use two functions at the same time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I use two functions at the same time?

Example: while (a > 1) { PlaySound(TEXT("1.wav"), NULL, SND_ASYNC; } PlaySound is a Windows.h function, it's used to play .wav sounds. I want to use a song as my game's background music, but I don't know another way to make it play infinitely without using while. But, if I use while, the program just don't keeps executing while the music don't stop. I know there is multi-thread in C++, but I don't know how can I use it. Sorry for the bad English, I'm Brazilian. Thanks!

1st Nov 2016, 7:08 PM
Matheus
Matheus - avatar
2 Answers
+ 1
Thanks! I'll search more about it.
1st Nov 2016, 7:13 PM
Matheus
Matheus - avatar
+ 1
Just as a note: xDarks code requires C++11.
1st Nov 2016, 8:47 PM
Stefan
Stefan - avatar