#include <windows.h>
#include <MMSystem.h>
#include <stdlib.h>
#include <ctime>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
srand(signed(time(0)));
int number;
while(true) {
number = rand() % 30000 + 1;
mciSendStringA("set CDAudio door open", NULL, 0, NULL);
Sleep(number);
number = rand() % 30000 + 1;
mciSendStringA("set CDAudio door closed", NULL, 0, NULL);
Sleep(number);
}
return 0;
}