sounderme 2015-10-09 23:58 采纳率: 0%
浏览 1451

c++代码编译没错程序停止工作怎么办

#include
#include
using namespace std;
class Student
{public:
void setName(string _name)
{m_strName=_name;
}
string getName()
{return m_strName;
}
private:
string m_strName;
};
int main()
{ Student *str=new Student[20];
str->setName("慕课网");
cout<<str<<endl;
delete str;
str=NULL;
return 0;
}

  • 写回答

4条回答 默认 最新

  • Semaphores 2015-10-10 00:01
    关注

    delete[] str;

    评论

报告相同问题?