פורסם 2004 ביולי 121 שנים אני מעונין להציג את התאריך הנוכחי (system date) והשעה ע"ג המסך ולשמור ערכם במשתנה (אובייקט או string, או double).מישהו יכול להסביר לי כיצד עושים זאת ב c++?
פורסם 2004 ביולי 121 שנים הנה הקוד ופה יש הסבר על המשתנים השונים:http://www-ccs.ucsd.edu/c/time.html#include<iostream.h>#include<time.h>void main(){// Get today's date time_t tval = time(0); struct tm *tmp= localtime(&tval); int month = tmp->tm_mon+1; int day = tmp->tm_mday; int year = tmp->tm_year + 1900; int hour = tmp->tm_hour; int min = tmp->tm_min; int sec = tmp->tm_sec; int miliSec = tmp->tm_mili_sec; cout<<"today's date is: "<<day<<"."<<month<<"."<<year<<"\n"; cout<<"and the accurate time is: "<<hour<<":"<<min<<":"<<sec<<"\n";}
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.