Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- string input;
- cin>>input;
- string year = input.substr(0, 2);
- string month = input.substr(2, 2);
- string date = input.substr(4, 2);
- string gender;
- int genderNum = input[8] - 48;
- if (genderNum % 2 == 0)
- {
- gender = "male";
- }
- else
- {
- gender = "female";
- }
- int monthNum = (month[0] - 48) * 10 + (month[1] - 48);
- int yearNum = (year[0] - 48) * 10 + (year[1] - 48);
- if (monthNum > 40)
- {
- yearNum += 2000;
- monthNum -= 40;
- }
- else
- {
- monthNum -= 20;
- yearNum += 1900;
- }
- if (monthNum < 10)
- {
- cout<<"You are "<<gender<<" born on "<<date<<".0"<<monthNum<<"."<<yearNum<<endl;
- }
- else
- {
- cout<<"You are "<<gender<<" born on "<<date<<"."<<monthNum<<"."<<yearNum<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement