You are on page 1of 2

Alarm and buzzer (C++ Program)

/*

This software is the sound based software on c++ which is use blow sounds after a
particular time or when the user press any key , therefore it is use as the buzzer
in contests. This is the link of the alarm developed by me !

https://www.youtube.com/watch?v=r198d7G3ddU
*/

#include<dos.h>
#include<conio.h>
#include<iostream.h>
#include<time.h>
#include<process.h>
void d()
{
cout<<"nntttPress any key to stop the timer.";
cout<<"nnnnnnnntttt ALARM SYSTEM";
cout<<"ntttt==============";

}
void main()
{
loop:
clrscr();
char ans;
float a;
d();
cout<<"nntttenter the value to set the alarm in minutes:";
cin>>a;
float f,s;
f=clock();
for(int i=(a*60),b=60;!(kbhit());i--,b--)
{
cout<<"nnttttTime remaind:"<<i/60<<":"<<b;
delay(1000);
if(i==0)
{
sound(500);
delay(500);
nosound();
break;
}
if(b==0)
{
b=60;
}
clrscr();
d();
}
s=clock()-f;
sound(500);
delay(1000);
nosound();

cout<<"nnnttttTIME OVER!";
cout<<"nntttYou buzz after:"<<(a*60)-i<<" seconds";
cout<<"nntttDo you want to use it again?(y/n)";
cin>>ans;
if(ans=='y'||ans=='Y')
{
goto loop;
}
else
{
exit(0);
}
getch();
}

You might also like