make sounds (beep) with c++
Solution 1:
Print the special character ASCII BEL
(code 7)
cout << '\a';
Source
Solution 2:
If you're using Windows OS then there is a function called Beep()
#include <iostream>
#include <windows.h> // WinApi header
using namespace std;
int main()
{
Beep(523,500); // 523 hertz (C5) for 500 milliseconds
cin.get(); // wait
return 0;
}
Source: http://www.daniweb.com/forums/thread15252.html
For Linux based OS there is:
echo -e "\007" >/dev/tty10
And if you do not wish to use Beep()
in windows you can do:
echo "^G"
Source: http://www.frank-buss.de/beep/index.html