找个大神 帮忙看看
#incldueusing namespace std;
struct teacher{
char* name;
char* fangxiang;
int cs;
};
void output(struct teacher * th)
{
cout<name<<":"<fangxiang<cs<<ENDL;
}
int main()
{
int n,i;
struct teacher * th;
cout<<"please input the number:"<<ENDL;
cin>>n;
th=new struct teacher[n];
if(th==NULL)
{
cout<<"memory creat false!!"<<ENDL;
}
else
{
(th+i)->name=new char[n];
(th+i)->fangxiang=new char[n];
if((th+i)->name==NULL&&(th+i)->fangxiang==NULL)
{
cout<<"memory creat false!"<<ENDL;
}
}
for(i=0;i<n;i++)
<N;I++)
{
cout<<"please input the data"<<ENDL;
cin>>(th+i)->name;
cin>>(th+i)->fangxiang;
cin>>(th+i)->cs;
}
for(i=0;i<n;i++)
<N;I++)
{
output(th);
}
for(i=0;i<n;i++)
{
delete[] (th+i)->fangxiang;
(th+i)->fangxiang=NULL;
delete[] (th+i)->name;
(th+i)->name=NULL;
}
delete[] th;
th=NULL;
return 0;
}
编译没错误 运行后出现内存问题 不知道怎么解决 求大神 指点;