Wednesday, 23 November 2011

Sound and Delay Functions in C & C++

Sound functions is used to make a sound or a sequence of sound in program. For example a piano C++ project use different sequences to get different sounds. Let start now:

#include<dos.h>
void main()
{

sound(any number);  //any sound number or name
sound(1200);

Different numbers contain different sounds and always remember that there should be a nosound();
function that end the sound. Use delay function to increase or decrease the timing of the sound.
delay(1000); // 1000=1 second

Review:

#include<dos.h>

void main()
{
clrscr();
sound(250);
delay(9000); // 9 second
nosound();

getche();
}

Hope you like this post. Thanks

Link:Sound in C++

No comments:

Post a Comment