0
How to delete a record in c++ file?
I have been assigned a little task to make a bank management system program in c++ where a user can insert his record, update his record and delete his record but I facing problem in deleting record. Kindly help me.
1 Odpowiedź
0
This might be obvious but the main steps you'll need to implement are:
1. Find the record to delete.
2. Update the data structure to represent that the record was deleted.
How those steps are implemented depends completely on your data structure containing all of these records.
If your records are stored in array, deleting could be as simple as decrementing an int length variable and moving all values after the deleted index down 1 index.
If your records are stored in a linked list so you have a separate node for each record, you'll have to manipulate the links and potentially the head or a tail appropriately. There are many kinds of linked lists. There are singly linked, doubly linked, you could maintain a head and tail links or just the head... All of these unique aspects of your data structure will affect how your delete operation works.
For singly linked list with just a nullable head pointer:
https://www.geeksforgeeks.org/linked-list-set-3-deleting-node/