The operating system is Ubuntu20.04. I used echo -e '\a' on the system terminal and the beep sound did play. So it has nothing to do with the device or the system settings.
When I ran the following code on VSCode,
#include <iostream>
using namespace std;
int main()
{
cout<<'\a';
cout<<endl;
return 0;
}
no sound was produced. When I used the TERMINAL to display the output, it showed up as a visual bell next to the terminal's name. And when I used the OUTPUT instead, a tiny red-background icon with white text "BEL" was output. red icon
Or maybe there is something wrong with the configuration of my VSCode?