求个 Visual c++高手 帮我看看下面一个题目 Please!!

来源:百度知道 编辑:UC知道 时间:2024/06/12 14:43:27
填空题 填写横线的空白 使程序输出如下要求结果
(5)要求输出结果
按姓名排序
排序前:
张三 男 出生日期: 1978年4月20日
王五 女 出生日期: 1965年8月3日
杨六 女 出生日期: 1965年9月5日
李四 男 出生日期: 1973年5月30日

排序后:
李四 男 出生日期: 1973年5月30日
王五 女 出生日期: 1965年8月3日
杨六 女 出生日期: 1965年9月5日
张三 男 出生日期: 1978年4月20日

#include<iostream>
using namespace std;

class Date{ // 日期类
int year,month,day; // 年、月、日
public:
Date(int year, int month, int day):year(year),month(month),day(day){}
int getYear()const{ return year; }
int getMonth()const{ return month; }
int getDay()const{ return day; }
};

class Person{ // 人员类
char name[14]; // 姓名
bool is_male; // 性别,为 true 时表示男性
Date birth_date; // 出生日期
public:
Person(char *name, bool is_male, Date birth_date)
//**********found**********
:_____________________________________________________

{
s

////结果为

#include<iostream>
using namespace std;

class Date{ // 日期类
int year,month,day; // 年、月、日
public:
Date(int year, int month, int day):year(year),month(month),day(day){}
int getYear()const{ return year; }
int getMonth()const{ return month; }
int getDay()const{ return day; }
};

class Person{ // 人员类
char name[14]; // 姓名
bool is_male; // 性别,为 true 时表示男性
Date birth_date; // 出生日期
public:
Person(char *name, bool is_male, Date birth_date)
//**********found**********
: is_male(is_male),birth_date(birth_date) //////

{
strcpy(this->name, name);
}
const char *getName()const{ return name; }

bool isMale()const{ return is_male; }

Date getBirthdate()const{ return birth_date; }

//利用strcmp()函数比较姓名,返回一个正数、0 或负数,分别表示大于、等于、小于
int compareName(const Person &p)const{
//**********found**********