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;
I the above case i am having the Exception thrown: read access violation. _Pnext was 0x148F854. Error.
The code ran perfectly on 2-3-2020. But today this error arises while deleting the customer from an array.