Updating a variable

Alright guys I'm making a clock and i would like to update the seconds minutes and hours without having to use system("CLS"); every time this is my code right now
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <ctime>
#include <cmath>
#include <Windows.h>

using namespace std;

int main()
{
	system("color 02");
	int Choice = 0;
	
	while(Choice == 0)
	{
	system("CLS");
	cout << "\n\n\t\t\t  Nick's Homemade clock" << endl;
	time_t seconds;
	time_t minutes;
	time_t hours;

	minutes = time(0) / 60 % 60;
	hours = time(0) / 3600 % 24 - 5; // - 5 Because epoch is set to UDT Time which is 5 hours ahead of Eastern standard time
	seconds = time(0) % 60;

	cout << "\n\n\t\t\t\t" << hours << ":" << minutes <<  ":" << seconds << endl;
	Sleep(1000);
	}
}

Say if i want to add an alarm clock feature to this currently i can't do it.
There are some other methods listed here if you don't want to use system calls.
http://www.cplusplus.com/forum/articles/10515/
Topic archived. No new replies allowed.