#include <iostream> #include <ctime> using namespace std; class TimeDate { public: TimeDate(time_t t); void show(); private: struct tm *timeS; }; TimeDate::TimeDate(time_t t) { timeS=localtime(&t); } void TimeDate::show() { cout<< timeS->tm_hour << endl; cout << timeS->tm_min << endl; cout << timeS->tm_sec << endl; } int main(void) { time_t x; x=time(0); TimeDate ob(x); ob.show(); return 0; }
E-mail/MSN: stylev@