Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

a c++ program to set a countdown timer

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

using namespace std;

int main()
{
	int m,s;
	int total;


	
	cout<<"Enter m and s"<<endl;
	cin>>m>>s;


	
		for(int sec = s; s>=0; s--)
		{
			
			cout<<"You have "<<"minutes"<<m<<"seconds"<<s<<endl;
			Sleep(200);
			
			if(s ==0)
			{
             total = m*60;

			 for(int min = total; total>=0; total--)
			 {
		 cout<<"You have the remaining seconds"<<total<<endl;
				 Sleep(200);
			 }



			}
		}

	



	 system("pause");


}
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #program #set #countdown #timer
ADD COMMENT
Topic
Name
9+5 =