I am working on a school project for linked list, and my append function can’t seem to be working properly [closed]

  append, c++

I am making a movie program for my school project and all the other functions are working properly except for the append, returnMovie function. All I want is for the chosen code to be appended to the end of my list.

Node *newNode, *nodePtr;
newNode = new Node;
string mCode;

system("pause");
system("CLS");

cout<<"Return a Movie!"<<endl;
cout<<endl;

cout<<"Enter movie code to return a movie: ";
cin>>mCode;

if (!head)
{
    head = newNode;
    cout<<"Movie List is empty!"<<endl;
    return;
}

    
else (node->movieCode == mCode);
{
    nodePtr = head;
    while (nodePtr->next)
    
        nodePtr = nodePtr->next;
        
    nodePtr->next = newNode;
    newNode=head;
    
    
}
cout<<endl<<"Input has been appended"<<endl;
system("pause");
system("CLS");

”’

Source: Windows Questions C++

LEAVE A COMMENT