程序自己运行没问题,但是一提交上去就有乱码

我自己根据题意写的代码,然后试运行了一下,发现没什么问题。但是一提交上平台就出乱码不知道咋回事,请专家帮忙看看我的代码。
附上题干:
【问题描述】设计一个用于人事管理的People(人员)类。考虑到通用性,这里只抽象出所有类型人员都具有的属性:姓名char name[11]、编号char number[7]、性别char sex[3]、生日birthday、身份证号char id[19]。其中“出生日期”声明为一个“日期”类内嵌子对象。用成员函数实现对人员信息的录入和显示。要求包括:构造函数和析构函数、拷贝构造函数、内联成员函数。在测试程序中声明people类的对象数组(要求使用动态内存分配生成对象数组),录入数据并显示相关信息。注:输出信息时先通过拷贝构造函数生成第一个员工的副本并输出其相关信息,然后再输出所有员工的相关信息。

【输入形式】先输入员工人数,再依次输入每个员工的信息。

【输出形式】输出信息时先通过拷贝构造函数生成第一个员工的副本并输出其相关信息,然后再输出所有员工的相关信息。

【样例输入】

员工人数:2

姓名:张山

编号:1001

性别(男/女):男

出生日期(年 月 日):1998 01 01

身份证号:510215199801010888

姓名:李四

编号:1002

性别(男/女):女

出生日期(年 月 日):1999 02 02

身份证号:500213199902020666

【样例输出】

 姓名:张山

编号:1001

性别:男

出生日期:1998年1月1日

身份证号:510215199801010888

姓名:张山

编号:1001

性别:男

出生日期:1998年1月1日

身份证号:510215199801010888

姓名:李四

编号:1002

性别:女

出生日期:1999年2月2日

身份证号:500213199902020666

【样例说明】

【评分标准】3个评分点

以下是我写的代码:

#include<iostream>
using namespace std;
class Date {
public:
    int Year, Month, Day;
};
class People {
public:
    void Input();
    void Output();
private:
    string name;
    string number;
    string sex;
    Date birthday;
    string id;
};
void People::Input() {
    cout << "姓名:";
    string _name;
    cin >> _name;
    name = _name;
    cout << "编号:";
    string _number;
    cin >> _number;
    number = _number;
    cout << "性别(男/女):";
    string _sex;
    cin >> _sex;
    sex = _sex;
    cout << "出生日期(年 月 日):";
    int year, month, day;
    cin >> year >> month >> day;
    birthday.Year = year;
    birthday.Month = month;
    birthday.Day = day;
    cout << "身份证号:";
    string _id;
    cin >> _id;
    id = _id;
}
void People::Output() {
    cout << "姓名:" << name << endl;
    cout << "编号:" << number << endl;
    cout << "性别:" << sex << endl;
    cout << "出生日期:" << birthday.Year << "年" << birthday.Month << "月" << birthday.Day << "日" << endl;
    cout << "身份证号:" << id << endl;
}
int main() {
    cout << "员工人数:";
    int n;
    cin >> n;
    People* p = new People[n];
    for (int i = 0; i < n; i++)
        p[i].Input();
    p[0].Output();
    for (int i = 0; i < n; i++)
        p[i].Output();
    system("pause");
    return 0;
}

img

  1. 你这里没有给出构造函数
  2. 算法题的输入不需要任何提示信息, 会被误判的