Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. # include <ctime >
  2. # include <iostream >
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. void print_time()
  8. {
  9.     stringstream s;
  10.     time_t t = time(0);
  11.     struct tm now;
  12.     localtime_s(&now, &t);
  13.     s
  14.         << now.tm_hour << ':' << now.tm_min << ':'
  15.         << now.tm_sec << endl;
  16.     cout << s.str() << endl;
  17. }
  18.  
  19. int main(int argc, char **argv) {
  20.     print_time();
  21.     getchar(); getchar();
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement