How to make the hardware beep sound with c++?
Thanks
std::cout << '\7';
cout << "\a";
In Xcode, After compiling, you have to run the executable by hand to hear the beep.
Here's one way:
cout << '\a';
From C++ Character Constants:
Alert: \a
Easiest way is probbaly just to print a ^G ascii bell
cout << '\a';
Source
:)
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
int main()
{
Beep(1568, 200);
Beep(1568, 200);
Beep(1568, 200);
Beep(1245, 1000);
Beep(1397, 200);
Beep(1397, 200);
Beep(1397, 200);
Beep(1175, 1000);
cout<<endl;
_getch()
return 0
}