C++ program to generate beep sound. Here for this purpose dos.h header file is used. In this program sound() function, delay() function and nosound() function are used.This program will generate beep sound from the PC speaker.
#include<iostream.h>
#include<conio.h>
#include<dos.h>
main()
{
clrscr();
sound(500); // 500 is frequency
delay(1000); // time delay in milliseconds
nosound(); // it will stop the sound
getch();
}
#include<iostream.h>
#include<conio.h>
#include<dos.h>
main()
{
clrscr();
sound(500); // 500 is frequency
delay(1000); // time delay in milliseconds
nosound(); // it will stop the sound
getch();
}
No comments:
Post a Comment