Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cstdio>
- #include <ctime>
- using namespace std;
- /*struct tm
- {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
- };*/
- class Data
- {
- public:
- int rok;
- int miesiac;
- int dzien;
- void wyswietl()
- {
- cout << "Dzisiejsza data (YYYY-MM-DD) to: " << rok << "-" << miesiac << "-" << dzien << endl;
- }
- };
- int main()
- {
- struct tm *czas;
- time_t tim;
- time(&tim);
- czas = localtime(&tim);
- int rok = czas->tm_year + 1900;
- int miesiac = czas->tm_mon + 1;
- int dzien = czas->tm_mday;
- Data data;
- data.rok = rok;
- data.miesiac = miesiac;
- data.dzien = dzien;
- data.wyswietl();
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement