301pass cpp2024
301pass cpp2024
#include <string>
using namespace std;
class Part {
public:
int partID;
string partName;
int quantity;
Part* next;
class Inventory {
public:
Part* head;
Inventory() : head(nullptr) {}
if (!current) {
cout << "Part ID " << partID << " not found." << endl;
return;
}
previous->next = current->next;
delete current;
cout << "Part ID " << partID << " deleted from the inventory." << endl;
}
int main() {
cout << "----------------------------------------------" << endl;
cout << "Computer Parts Management System [BC230203256]" << endl; // Change to
your student ID
cout << "----------------------------------------------" << endl;
Inventory storeInventory;
// Pre-populated data for demonstration
storeInventory.addPart(101, "SSD", 25);
storeInventory.addPart(102, "RAM", 40);
storeInventory.addPart(103, "HDD", 15);
cout << "After deleting SSD and updating RAM Quantity..." << endl << endl;
return 0;
}