You are on page 1of 1

/* clock example: countdown with 1 second interval*/

#include <iostream.h>
#include <time.h>
#include<conio.h>
void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait) {}
}
void main ()
{
int n;
cout<<"Starting countdown...\n";
for (n=10; n>0; n--)
{
cout<<n<<"\n";
wait (1);
}
cout<<"FIRE!!!\n" ;
getch();
}

You might also like