how to make a console program make noise

Mar 20, 2011 at 9:10pm
I need to know how to make a console program make noise. Like a beep beep
in different tones. Dose eny budy have an exampol?
Mar 20, 2011 at 9:17pm
1
2
3
4
5
6
7
#include<windows.h>

int main()
{
    Beep(1000, 2000);// 1000 herts for 2000 ms
    return 0;
}


Does that work?

Edit: No need for #include<iostream>, duh.
Last edited on Mar 20, 2011 at 9:56pm
Mar 20, 2011 at 9:22pm
closed account (3hM2Nwbp)
If I recall, the Beep function doesn't work in Vista, Server 2008, and potentially others because Microsoft removed the feature.
Mar 20, 2011 at 9:30pm
I will try that. thanks!
Mar 20, 2011 at 9:34pm
It werked! thanks browni3141.
Mar 20, 2011 at 10:07pm
here is a program that I made with what you gave me.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
#include<windows.h>
#include <conio.h>

int main()
{
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute( handle, 6000 );
	std::cout<< "this program makes crazy noise" << std::endl;
	_getch();
	std::cout << "your mind is being minepulated!" <<std::endl;
    Beep(6000, 9000);
    Beep(658, 100);
    Beep(425, 100);
    Beep(412, 100);
    Beep(425, 100);
    Beep(456, 100);
    Beep(213, 100);
    Beep(654, 100);
    Beep(245, 100);
    Beep(243, 100);
    Beep(452, 100);
    Beep(457, 100);
    Beep(45, 100);
    Beep(54, 100);
    Beep(78, 100);
    Beep(87, 100);
    Beep(89, 2100);
    Beep(98, 100);
    Beep(789, 100);
    Beep(987, 100);
    Beep(456, 100);
    Beep(85, 100);
    Beep(95, 100);
    Beep(45, 100);
    Beep(54, 4100);
    Beep(45, 100);
    Beep(456, 100);
    Beep(745, 100);
    Beep(524, 100);
    Beep(4521, 100);
    
    return 0;
}
Mar 21, 2011 at 12:30am
interesting... I should stuff into one of my programs and make people think that they are in Star Trek or some other scifi thing with beeping computers.
Mar 22, 2011 at 12:44am
Thats cool!
Topic archived. No new replies allowed.