简单做了个例子供参考。

程序代码:
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <windows.h>
#pragma comment(lib, "winmm.lib")
#include <Mmsystem.h>
#include <conio.h>
using namespace std;
void play() // 播放
{
char File[] = "C:\\Windows\\Media\\Ring06.wav";
PlaySoundA(File, NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
cout << "按任意键关闭语音" << endl;
while (!_kbhit())
Sleep(500);
PlaySoundA(NULL, NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
}
int main()
{
int sec;
char buf[20] = {0};
cout << "输入倒计时(秒):";
cin >> sec;
while (sec >= 0)
{
sprintf(buf, "\b\b%02d", sec);
cout << buf;
sec--;
Sleep(1000);
}
cout << "\n时间到!" << endl;
play();
return 0;
}