
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A c++ program that creates a linked list by taking input from the user and deletes a node with a given value. The program includes the declaration of a nodetype struct, the implementation of a delete function, and the main function that creates the list and deletes nodes based on user input.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

#include
currPtr->link = NULL; // display the list cout << " Printing the list " << endl; currPtr = head; while (currPtr != NULL) { cout << currPtr->component; cout << endl; currPtr = currPtr->link; } cin >> inputVal; while ( inputVal != 0 ) { if ( Delete( inputVal, head )){ cout << " Printing the list " << endl; //display the list currPtr = head; while (currPtr != NULL) { cout << currPtr->component; cout << endl; currPtr = currPtr->link; } } cin>> inputVal; } return 0; } bool Delete( ComponentType item, NodePtr head) {