-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdig_clock.cpp
More file actions
39 lines (30 loc) · 937 Bytes
/
Copy pathdig_clock.cpp
File metadata and controls
39 lines (30 loc) · 937 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <ctime>
#include <iomanip>
#include <windows.h>
using namespace std;
int main()
{
while(true)
{
time_t now = time(0);
tm *localTime = localtime(&now);
system("cls");
cout << "==========================" << endl;
cout << " DIGITAL CLOCK " << endl;
cout << "==========================" << endl;
cout << endl;
cout << "Time: "
<< setfill('0') << setw(2) << localTime->tm_hour << ":"
<< setfill('0') << setw(2) << localTime->tm_min << ":"
<< setfill('0') << setw(2) << localTime->tm_sec
<< endl;
cout << "Date: "
<< setfill('0') << setw(2) << localTime->tm_mday << "/"
<< setfill('0') << setw(2) << localTime->tm_mon + 1 << "/"
<< localTime->tm_year + 1900
<< endl;
Sleep(1000);
}
return 0;
}