Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <time.h>
- #include <iostream>
- int main()
- {
- using namespace std;
- int birthData;
- time_t theTime = time(NULL);
- struct tm *aTime = localtime(&theTime);
- int day = aTime->tm_mday;
- int month = aTime->tm_mon + 1; // Month is 0 - 11, add 1 to get a jan-dec 1-12 concept
- int year = aTime->tm_year + 1900;
- cout<<"Podaj date urodzenia\n";
- cin >>birthData;
- cout<<year<<endl;
- int DataUrodzenia = year-birthData;
- cout<<DataUrodzenia<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement