#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<dos.h>
class time1
{
int *rem;
int m,s;
public:
time1();
~time1();
};
void time1::time1()
{
rem=new int;
cout<<"\n\tCountdown timer";
cout<<"\n\tEnter the time in minutes:";
cin>>m;
cout<<"\n\tEntr time in seconds";
cin>>s;
cout<<"\n\tpress any key to start!!";
getch();
clrscr();
cout<<"\n\tTimer:";
cout<<"\n\tRemaining Time is :";
cout<<"\n\tPress shift +break to pause";
cout<<"\n\tPress cntrl + any key to Resume\n\t";
for(rem=&s;*rem>=0;(*rem)--)
{
sleep(2);
cout<<"\t\r"<<setw(1)<<m<<":"<<setw(2)<<*rem;
}
for(int min=m;min>0;min--)
{
for(int sec=59;sec>=0;sec--)
{
sleep(2);
cout<<"\t\r"<<setw(1)<<min-1<<":"<<setw(2)<<sec;
}
}
cout<<"\n\tEnded";
}
time1::~time1()
{
clrscr();
delete rem;
cout<<"\n\n\tconstructor memory is destroyed:";
cout<<*rem;
}
void main()
{
time1 t;
}
Comments
Post a Comment