帮忙看看这个程序的错误
#include <iostream>#include <string.h>
using namespace std;
class Girl{
private :
string*name;
int age;
public :
Girl(string*n,int d)
{
name=new string[strlen(n)+1];
name=n;
age=d;
}
friend void disp(Girl&);
~Girl()
{
delete []name;
}
};
void disp(Girl&x)
{
cout<<"The girl's name is "<<x.name<<",age is "<<x.age<<"."<<endl;
}
int main()
{
string name;
cin>>name;
int age;
cin>>age;
Girl g1(name,age);
disp(g1);
return 0;
}