Adding a While Loop

This is my code for a digital clock. It only refreshes when i type in a letter. Can somebody please help me find a way to write it so it refreshes automatically?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;

//char dateStr [9];
char timeStr [9];
char almtimestr[9];

int main()
{
	while (1)
	{
		_strtime_s( timeStr);
		_strtime_s( almtimestr);

		int consoleWidth=70;
		cout<<setw(consoleWidth / 10)<<" "<<timeStr<<endl;
		cin >> almtimestr;

		if (memicmp(almtimestr,"Y",1)==0 || memicmp(almtimestr,"y",1)==0 )
			break;
}
Last edited on
I need to find a way to have it automatically refreshing. If you could help me with this that would be great.
I see you edited your post, but you forgot the closing } of your while loop. Also, you are requesting input from the user every time, so it cannot "refresh automatically".
Topic archived. No new replies allowed.