make sounds (beep) with c++

前端 未结 12 637
暗喜
暗喜 2020-11-29 04:08

How to make the hardware beep sound with c++?

Thanks

相关标签:
12条回答
  • 2020-11-29 04:21
    std::cout << '\7';
    
    0 讨论(0)
  • 2020-11-29 04:21
    cout << "\a";
    

    In Xcode, After compiling, you have to run the executable by hand to hear the beep.

    0 讨论(0)
  • 2020-11-29 04:24

    Here's one way:

    cout << '\a';
    

    From C++ Character Constants:

    Alert: \a

    0 讨论(0)
  • 2020-11-29 04:29

    Easiest way is probbaly just to print a ^G ascii bell

    0 讨论(0)
  • 2020-11-29 04:33
    cout << '\a';
    

    Source

    :)

    0 讨论(0)
  • 2020-11-29 04:33
    #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
    }
    
    0 讨论(0)
提交回复
热议问题