某位青年 2019-04-25 11:44 采纳率: 0%
浏览 391
已采纳

num未定义?? 无法删除pstaff无法删除,求助大佬!

void StaffManage::xianshi()
{
system("cls");
cout << "/---------------高校人员信息管理系统---------------\\n";
cout << "| |\n";
cout << "| 2.显示功能 |\n";
cout << "| |\n";
cout << "\--------------------------------------------------/\n";
cout << "教师信息" << endl;
for (auto i : tea)
cout << i.num << " " << i.name << " " << i.xingbie<< " " << i.age << " " << i.xibu << " " << i.major << " " << i.prof << endl;
cout << endl;
cout << "实验员信息" << endl;
for (auto i : ass)
cout << i.num << " " << i.name << " " << i.xingbie << " " << i.age << " " << i.job << " " << i.dep << endl;;
cout << endl;
cout << "行政人员信息" << endl;
for (auto& i : sta)
cout << i.num << " " << i.name << " " << i.xingbie << " " << i.age << " " << i.job << " " << i.dep <<""<<i.mianmao << endl;
cout << endl;
cout << "教师兼行政人员信息" << endl;
for (auto& i : aaa)
cout << i.num << " " << i.name << " " << i.xingbie << " " << i.age << " " << i.job << " " << i.dep << " " << i.mianmao << " " << i.xibu << " " << i.major << " " << i.prof << endl;
system("pause");

int pos;

for (pos = 0; pos < count; pos++)//循环搜索
{
    if (strcmp( IndexType::num, indexTable[pos].num) == 0 && !indexTable[pos].delTag)//比较来判断
        break;
}
if (pos < count)        //如果比最大值要小,那么一定是找到了的
{
    file.seekg(indexTable[pos].position, ios::beg);


    pstaff->Read(file);
    pstaff->Show();
    delete pstaff;
}
else
{
    cout << "查询失败" << endl;
    file.clear();
}

}
图片说明

  • 写回答

1条回答 默认 最新

  • aalbertini 2019-04-25 13:50
    关注

    这些错都提示得很清楚了。
    pstaff 不是个指针类型、 甚至都没有声明; 不能使用delete删除它。
    仔细看代码吧。
    大佬,请采纳

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码