Tuesday, 3 February 2015

Sound in C++

Structure of the problem requirements

The sound exist in windows.h library in C++ program.The Beep function is used to create the sound and this function take 2 parameters. The one parameter take the frequency and the second take the time.

Source Code 

#include<iostream>
#include<windows.h>
using namespace std;
int main ()
{
top : int choice = 0;
cout<<"\t \t \t LEP Tutorials \n \n";
cout<<"\t \t 1. Small Sound \n \n ";
cout<<"\t \t 2. Loud Sound \n \n ";
cout<<"\t \t 3. Very Loud Sound \n \n ";
cout<<"Enter Your Choice to Play the Sound \n \n ";
cin>>choice;
if (choice == 1)
{
cout<<" Small Sound Played \n \n ";
Beep (500,500);
}
if (choice == 2)
{
cout<<" Loud Sound Played \n \n ";
Beep (1000,1000);
}
if (choice == 3)
{
cout<<" Very Loud Sound Played \n \n ";
Beep (3000,3000);
}
else
{
goto top;
}
}

Output of the Program

Sound in C++

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment