I need to get the current time. I looked up time using the search feature, but I can't find any C++ time functions or headers. I only found time.h, and that's for C.
#include <iostream>
#include <time.h>
#include <windows.h>
#include <ctime>
usingnamespace std;
int main()
{
while(1)
{
time_t current = time(0);
cout << ctime(¤t);
system("cls");
}
}
//EXPLANING THE CODE
//time_t is a type used to hold time values.
//Usually represents the number of seconds since 1970.
//time(0) returns the current time as a time_t object.
//ctime() converts the parameter to a human readable
//string representing the time stored.