i wonder what my error is this is my .h code #ifndef NUMBERLIST_H #define NUMBER
ID: 3917022 • Letter: I
Question
i wonder what my error is this is my .h code
#ifndef NUMBERLIST_H
#define NUMBERLIST_H
class NumberList
{
private:
//Declare structure from node list
struct list
{
char variable;
struct list *next;
};
//list head pointer
list *head;
public:
//Linked list operations
void appendNode(int);
void insertNode(char,int);
void deleteNode(int);
void printNode()const;
void reverseNode();
void searchNode(char);
};
#endif
NumberList: yoid appendNode (int value) list *newNode; //point to new node list nodePtr; //moves through the list //allocates a new node and stores it into value newNode-new list; newNode->variable = value; newNode ->next -nullptr; //if there are no nodes in the 1ist this will make a new list if (Ihead) head newNode; else //intialize ptr to head //find last node in the list while (nodePtr->next) nodePtrnodePtr->next; /linsert new node at the last node nodeltr 2 next -nefodeExplanation / Answer
The error in the code is the declaration of the function. The code of appendNode() is correct. You just need to change the declaration to
void NumberList::appendNode(int value)
{
// add the code here
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.