Beep implementation in C++