【发布时间】:2020-08-27 10:29:34
【问题描述】:
case 4: // ---------------------------------------- Delete Customer
cout << "Enter your Customer ID:" << endl;
cin >> exist_id;
for (int i = 0; i <= cnum; i++) {
if (c[i].C_ID() == exist_id) {
cc = 't'; // check to set customer found.
c[i].~customer(); // error occurs here
c[i].id(NULL);
cout << "Deletion Successful" << endl << endl;
break;
}
};
if (cont(cc) == false) {
cout << "CUSTOMER NOT FOUND" << endl << endl;
}
cc = 'f';
//system("CLS");
break;
在上述情况下,我抛出了 异常:读取访问冲突。 _Pnext 是 0x148F854。错误。
代码在 2020 年 2 月 3 日完美运行。但是今天从数组中删除客户时会出现此错误。
【问题讨论】:
标签: c++ oop destructor