Write based on Monster group and GPT:
Step:
Define the structure of the equipment, including the name, type, price and other information of the equipment;
Design a data structure for a storage device, such as a set of numbers or a linked list;
implements the function of display, search, add, delete and save according to the product name, including:
Display all device information: traverses the device array or linked list, output the information of each device;
Search for device information: According to the input device name, search for the device in the device array or linked list, and output the device information;
Add device information: According to the input device information, add the device to the device array or linked list;
Delete device information: According to the input device name, search the device in the device array or linked list, and delete the device;
Save device information: Saves information in a device array or linked list to a file.
In the main function, call the above function to realize the management of the device inventory.
Note that when calculating the price of a TV set with DVD, you need to first determine whether the DVD device exists, and if it does not, you need to first add the DVD device. In addition, file operation functions can be used to save device information, such as fopen, fwrite, fclose, etc.