How to replace data in a certain node in a linked list?
<p>I have an exercise using linked lists for my class. I am fairly new to the language, but I've given it an attempt. The instructions tell us to "iterate through until NodeData is found, then replace the data using the sets."
What are "the sets" in C++? I've looked online and I couldn't find anything. The only thing I can think of is setting the nodes to point somewhere else. For example <code>head-&gt;NULL</code>. But is this really necessary if I am simply replacing the data? To replace the data I've tried <code>temp-&gt;order = NEWDATA</code>. Is that the correct implementation? It did not seem to work. Maybe it was an error in a different part of the code.</p>

<pre><code>bool OrderLL::Modify(Order * NodeData) {
    OrderNode *temp = head;
    if (temp == NULL) {
        cout &lt;&lt; "Empty List";
    }
    else {
        while (temp != NULL) {
            if (temp-&gt;order == NodeData) {

                //not sure if this is the proper way of deleting data inside a node
                delete anOrder;
               //HOW DO I REPLACE THE DATA IN THIS PART?
            }
            temp = temp-&gt;next;
        }
    }

return false;
}
</code></pre>

<p>On a side note, I really do not understand why  I continue to recieve downvotes on all my questions. Is it because they're basic C++ questions? They're not so basic to me. I know this website looks down upon "offtopic/chat discussions" but I just don't understand what is wrong with my questions.</p>