Portion of a Doubly Linked list function not working correctly
<p>in this function i have used 2 conditions , for response == 1 , pointer is returned by registration no and that function works perfectly fine, on the other hand, if response==2 , pointer is returned by the string name, in the case it takes the new input name but then programe ends suddenly, </p>

<p>I have added both the pointer return function and the editing function ! Please Help </p>

<pre><code>     // edit student function , helping functions , pointer by registration and name 
     // at end    
 void LAB_PROJECT::edit_student()
 {
    int response = 0;
    string search_name;
    int search_reg = 0;

    cout &lt;&lt; "\n \n  -- Select Search Option 1 or 2 Accordingly" &lt;&lt; endl;
    cout &lt;&lt; "\n       1--Registration ";
    cout &lt;&lt; "\n       2--Student's Name" &lt;&lt; " &gt;&gt;  " ;
    cin &gt;&gt; response;

    if (response==1)
    {
        cout &lt;&lt; "\n \n Enter Registration No: ";
        cin &gt;&gt; search_reg;

        Node*temp1;

        temp1 = pointer_by_registration(search_reg);

        cin.ignore(1,'\n');
        string new_name;

        cout &lt;&lt; "\n \n Enter New Name ";
        getline(cin,new_name,'\n');
        temp1-&gt;student_name = new_name;
        return;

    }
    else if(response==2)
    {
        cout &lt;&lt; "\n \n Enter Student's Name , that you want to search " &lt;&lt; endl;
        getline(cin,search_name,'\n');
        cin.ignore(1,'\n');
        Node*temp2;

        temp2 = pointer_by_name(search_name);
        string new_name;

        cout &lt;&lt; "\n \n Enter New Name";
        getline(cin,new_name,'\n');
        cin.ignore(1,'\n');
        temp2-&gt;student_name=new_name;
        return;
    }
 }

 Node* LAB_PROJECT::pointer_by_name(string getin)
 {
       string checker;
       checker = getin;

       Node*temp1;
       temp1 = startptr;

       while(temp1 != NULL)
       {
           if (checker == temp1-&gt;student_name)
           {
               return (temp1);
           }
           temp1=temp1-&gt;nextptr;
       }
  }


 Node* LAB_PROJECT::pointer_by_registration(int reg_key)
{
int key = 0;
key = reg_key;

Node* temp1;
temp1 = startptr;

while(temp1 !=NULL)
{
    if(key == temp1-&gt;registration)
    {
        return(temp1);
    }
    temp1=temp1-&gt;nextptr;
 }
 }
</code></pre>
