Write a program that acts as a simple stop watch When the pr
Write a program that acts as a simple stop watch. When the program starts, 0 is displayed on the screen. If the user hits Ctrl-C, the stop watch pauses/unpauses. While the stop watch is unpaused, itincrements by 1 every second. If the user hits Ctrl the program prints \"Goodbye\" and then terminates gracefully Local echoing should be turned off while the program runs so Acisnot displayed when the user hitsctrtc Besure to restore echoing before the program terminates. 

Solution
#include <stdio.h>
#include<conio.h>
int h=0,m=0,s=0,ms=0;
char ch =\'ctrl c\';
void main()
{
void watch();
watch();
while (1)
{
if (kbhit())
ch=getch();
if (ch ==\'s\' )
break;
if (ch == \'ctrl-\\\' )
exit (0);
}
while(1)
{
watch();
delay(1);
if(kbhit())
ch=grtch();
if( ch==\'r\')
{
h=m=s=ms=0;
watch();
while(1)
{
if(kbhit())
ch=getch();
if(ch==\'s\')
break;
if(ch==\'ctrl-\\\')
exit(0);
}
}
else
if(ch==\'ctrl c\'\')
while(1)
{
if(kbhit())
ch=getch();
if(ch==\'s\')
break;
if(ch==\'ctrl-\\\')
exit(0);
}
else
{
if(ch==\'ctrl-\\\')
exit(0);
if(ms! =99)
ms++ ;
else
{
if(s!=59)
s++;
else
{
s=0;
if(m!=59)
m++;
else
{
m=0;
h++;
}
}
}
}
}
void watch()
{
clrscr();
printf(\" stopwtch\") ;
printf(\"press any key\");
printf(\"start\");
printf(\"pause\");
printf(\"reset\");
printf(\"good bye\");
}


