here is a wonderful short program to try out!

A COUNTDOWN TIMER

#include<iostream.h>
#include<conio.h>

main()
{


int m,s;

cout<<"\n\n\n\t\t\t     A COUNTDOWN TIMER \n";

cout<<enter time in MINUTES here \t = \t";
cin>>m;

cout<<enter time in SECONDS here \t = \t";
cin>>s;




cout<<"\n\n\n\n\t press any key to start...!!!";

getch();
clrscr();


cout<<"\n\n\n\t\t\t     A COUNTDOWN TIMER \n";

cout<<"\n\n\n\t\t TIME REMAINIG \n\n";

cout<<"\t mins: \t\t seconds: ";

for(int min=m;min>0;min--)
{
for(int sec=59;sec>=;sec--)
{

sleep(1);

cout<<"\r"<<min<<"\t"<<sec;

}

}

for(int rem=s;rem>=0;rem--)
{
cout<<"\r"<<min<<"\t"<<rem;
}

cout<<"\n\n  ENDED ";

return 0;

}               /* end of program */



/* developed by piyush */

Why are you using the C snippets for a C++ snippet? There is a difference between the two old languages.

It should be int main(void) and lines 12 and 15 will cause errors due to a missing " at the beginning of the string.

This is a much better program than the one above.

#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <windows.h>


 using namespace std;

int main()

{

	 int m, s,h;

	 cout << "A COUNTDOWN TIMER " << endl;
	 cout << "enter time in hours here" << endl;
	 cin >> h;
	 cout << "enter time in minutes here " << endl;
	 cin >> m;

	 cout << "enter im in seconds here" << endl;
	 cin >> s;

	 cout << "Press any key to start" << endl;

	 cout << " A COUNTDOWN TIMER" << endl;
	 cout << "time remaining" << endl;
	 cout << "hours : " << h << "mins : " << m << " secs : " << s << endl;

	 for (int hour = h; hour >= 0; hour--)
	 {
		 for (int min = m; min >= 0 ; min--)
		 {
			 if ( min == 0 && h > 0)
				 m = 59;
			for (int sec = s; sec >= 0; sec--)
			{
				if ( sec == 0 )
					s = 59;
				Sleep(1000);
				system("cls");
				cout << hour << " :hours " << min << " :mins " << sec << " :secs"  << endl;
			}
		 }
	 }
	 
	Sleep(1000);
	 cout << "THE END" << endl;
	 

	return 0;

Edited 6 Years Ago by Nick Evan: Added code-tags

here is a wonderful short program to try out!

Which header file will I use to call the sleep function bcos I am using DEV-cpp