Ads Top

How to create sound using c and cpp

        #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<dos.h>
void main()
{
int i;
char ch;
clrscr();
clrscr();
textcolor(2+BLINK);
textbackground(15);
gotex(20,12);
ccout("press enter to stop");
ch=getch();
while(ch!=13)
{
sound((ch+50)*20);
delay(30);
nosound();
ch=getch();
}
nosound();

}


OUTPUT:

Sound is generated.

PRESS ENTER TO STOP.

  

No comments:

Touchfeeds. Powered by Blogger.