C++ Linked list issues with strings
<p>I'm quite new to C++ and currently trying to insert a phone number and name inside of a linked list that the user can set.I'm wondering where I'm going wrong, I've been watching video after video but everything is about using integers in linked lists and not strings.</p>

<p>So if main was taken out the program shows (0)errors and (0)warnings so I think the problem is in main. </p>

<p>So in main I'm trying to cin nam(which is what I have inside the function part of set_first). I've tried passing it an address but I think I'm just pulling at straws with that. </p>

<p>So the question is: Can anyone point me in the right direction, or let me know how I could put a name and a phone number into a node that a user specifies?</p>

<p>Here's my the programs thus far descending from main:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include "l_List_1.h"

using namespace std;

int main()
{
    l_List_1 obr;

    std::string nam;
    cout &lt;&lt; "name";
    cin &gt;&gt; nam;
    obr.set_first(nam); //I'm trying to give it the nam since that's what I have inside my set_first function.



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

<p>My header file looks like this:</p>

<pre><code>#ifndef L_LIST_1_H
#define L_LIST_1_H


class l_List_1
{
public:
    l_List_1();
    void set_first(std::string nam, int phnum);
    void delete_Node(std::string del_nams, int num_del);
    void display();
    char menu();


private:
    typedef struct node {
        std::string user_Name;
        int user_Phone;
        node* next;
    }* nodeptr;

    nodeptr head;
    nodeptr curr;
    nodeptr tail;
    nodeptr temp;
};

#endif // L_LIST_1_H
</code></pre>

<p>and my cpp file is here:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;string&gt;
#include "l_List_1.h"

using namespace std;


l_List_1::l_List_1()
{
    head = NULL;
    curr = NULL;
    tail = NULL;
}

void l_List_1::set_first(std::string nam, int phnum) {
    nodeptr n = new node;
    n-&gt;next = NULL;
    n-&gt;user_Name = nam;
    n-&gt;user_Phone = phnum;

    cout &lt;&lt; "name";
    cin &gt;&gt; nam;

    if (head != NULL) {
        curr = head;
        while (curr-&gt;next != NULL) {
            curr = curr-&gt;next;
        }
        curr-&gt;next = n;
}
    else {
        head = n;
    }
}

void l_List_1::delete_Node(std::string del_nams, int num_del){
    nodeptr delptr = NULL;
    temp = head;
    curr = head;
    while(curr != NULL &amp;&amp; curr-&gt;user_Name != del_nams &amp;&amp; curr-&gt;user_Phone != num_del){
        temp = curr;
        curr = curr-&gt;next;
    }
    if(curr == NULL){
        cout &lt;&lt; del_nams &lt;&lt; "Was not in the list";
        cout &lt;&lt; num_del &lt;&lt; "was not in the list";
        delete delptr;
    } else{
        delptr = curr;
        curr = curr-&gt; next;
        temp-&gt;next = curr;
        delete delptr;
        cout &lt;&lt; "the item" &lt;&lt; del_nams &lt;&lt; "was deleted";
        cout &lt;&lt; "the item" &lt;&lt; num_del &lt;&lt; "was deleted";
    }
}

void l_List_1::display(){
    curr = head;
    while(curr != NULL){
        cout &lt;&lt; curr-&gt;user_Name;
        cout &lt;&lt; curr-&gt;user_Phone &lt;&lt; endl;
        curr = curr-&gt;next;
    }
}
</code></pre>