+ 3
how to display current time in a c++ program
5 Antworten
+ 3
time(0) shows current time but it return variable of structure time_t
inorder to access it u have to use another structure variable like
time_t t=time(0).
then using localtime()function u can output minute,hr,second,day,month,year anything
+ 2
ya bro time.h or ctime
+ 2
actually localtime also return pointer to structure named tm
so u have to use it too like this
struct tm* ptr=localtime(&t);
then use tm-> day , tm->hour,tm->min freely
+ 1
Should we include any particular header file for localtime() function
+ 1
Ok thanks