#include <iostream>
#include <cstring>
class Date {
public:
int year, month, day;
Date() : year(0), month(0), day(0) {}
Date(const char* dateStr) {
sscanf(dateStr, "%d-%d-%d", &year, &month, &day);
}
// 将日期转换为yyyymmdd格式的字符串
char* toYYYYMMDD() {
static char dateStr[9];
sprintf(dateStr, "%04d%02d%02d", year, month, day);
return dateStr;
}
};
class People {
private:
char name[11];
char number[7];
char sex[7];
Date birthday;
char id[20];
public:
People() {
memset(name, 0, sizeof(name));
memset(number, 0, sizeof(number));
memset(sex, 0, sizeof(sex));
memset(id, 0, sizeof(id));
}
void input() {
std::cin.getline(name, 11);
std::cin.getline(number, 7);
std::cin.getline(sex, 7);
char birthdayStr[11];
std::cin.getline(birthdayStr, 11);
birthday = Date(birthdayStr);
std::cin.getline(id, 20);
}
void display() {
if (strncmp(id + 6, birthday.toYYYYMMDD(), 8) == 0) {
std::cout << "Name: " << name << std::endl;
std::cout << "Number: " << number << std::endl;
std::cout << "Sex: " << sex << std::endl;
std::cout << "Birthday: " << birthday.year << "-" << birthday.month << "-" << birthday.day << std::endl;
std::cout << "ID: " << id << std::endl;
} else {
std::cout << "birthday mismatch!" << std::endl;
std::cout << "Name: " << name << std::endl;
std::cout << "Number: " << number << std::endl;
std::cout << "Sex: " << sex << std::endl;
std::cout << "Birthday: " << birthday.year << "-" << birthday.month << "-" << birthday.day << std::endl;
std::cout << "ID: " << id << std::endl;
}
}
};
int main() {
People person;
person.input();
person.display();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KCmNsYXNzIERhdGUgewpwdWJsaWM6CiAgICBpbnQgeWVhciwgbW9udGgsIGRheTsKCiAgICBEYXRlKCkgOiB5ZWFyKDApLCBtb250aCgwKSwgZGF5KDApIHt9CgogICAgRGF0ZShjb25zdCBjaGFyKiBkYXRlU3RyKSB7CiAgICAgICAgc3NjYW5mKGRhdGVTdHIsICIlZC0lZC0lZCIsICZ5ZWFyLCAmbW9udGgsICZkYXkpO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