Simple Timer

Simple Timer code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
	int hours;
	int minuets;
	int seconds;
	int Total_Time;

	cout << "How long would u like the timer to go: " << endl << "Hours: "; cin >> hours; cout << "Minuets: "; cin >> minuets; cout << "Seconds: "; cin >> seconds;//cout and cin for the input of the time

	hours = hours * 3600;//set hours to seconds
	minuets = minuets * 60;//sets minuets to seconds
	Total_Time = (hours + minuets + seconds) * 1000/*puts it into millseconds for sleep*/;
	//cout << Total_Time << endl; //test to check math
	Sleep(Total_Time);
	
	cout << "Time is up" << endl;

	return 0;
}
Topic archived. No new replies allowed.