First, add this at the top of the source file:
[highlight=c++]#pragma comment( lib, "Winmm.lib" )[/highlight]
After that, include this header file:
[highlight=c++]#include <Windows.h>[/highlight]
Finally, when you want to play the sound; add this line at that place:
[highlight=c++]PlaySound((LPCTSTR)L"C:\\Windows\\Media\\chimes.wa v",nullptr,SND_SYNC);[/highlight]
PlaySound function resides in the windows.h header file that plays the specified wav sound. We included #pragma comment( lib, "Winmm.lib" ) at the top of the source because we had to instruct the linker to add this additional dependency. #pragma comment is used to specify linker options.
Hope this clarifies and solves your question.