xfngrn13 0 Newbie Poster

hello can anybody help me with my code? its about link list with selection sorting by last name i've tried to code this for 3 weeks but until now a can't get it to run please help me thank you in advance here's my code

void sel_sort()
{
     node *temp, *temp1, *prevlow,*ptemp,*alow;
     node *min;
     temp=start_ptr;
     if(start_ptr==NULL)
        cout<<"the list is empty"<<endl;
       
     else
     {
       
         if(start_ptr->nxt==NULL)
           cout<<"there is only one node"<<endl;
         else
           {
           temp1=start_ptr->nxt;
               for(int i=0;i<10;i++)
               {
               min=temp;
                 if(temp->emplname[i]<temp1->emplname[i])
                       min=temp;
                    else
                    {
                        if(temp->emplname[i]>temp1->emplname[i])
                           min=temp1;
                    else
                        {
                               if(temp->empfname[i]>temp1->empfname[i])
                                 min=temp1;
                                                }
                                                }
                                                }
                                                }
                                                }
     temp=start_ptr;
   if(temp != start_ptr)
   {                if(temp->nxt==min)
                       { ptemp=start_ptr;
                         while(ptemp->nxt!=temp)
                           {ptemp=ptemp->nxt;}
                       
                            ptemp->nxt=min;
                            alow=min->nxt;
                            min->nxt=temp;
                            temp->nxt=alow;
                      }
                   else
                      {
                        ptemp=start_ptr;
                        while(ptemp->nxt!=temp)
                        {
                        ptemp=ptemp->nxt;
                        }
                        prevlow=start_ptr;
                        while(prevlow->nxt!=min)
                        {
                         prevlow=prevlow->nxt;
                         }
                        alow=min->nxt;
                        ptemp->nxt=min;  
                        min->nxt=temp->nxt;
                        prevlow->nxt=temp;
                        temp->nxt=alow;
                      }
                 }
              else
                 { if(temp->nxt==min)
                      {
                        alow=min->nxt;
                        min->nxt=temp;
                        temp->nxt=NULL;
                      }
                   else
                      {
                        alow=min->nxt;
                        min->nxt=temp->nxt;        
                        prevlow=start_ptr;
                        while(prevlow->nxt!=min)
                        {
                         prevlow=prevlow->nxt;
                         }
                        prevlow->nxt=temp;
                        temp->nxt=alow;
                      }
                   start_ptr=min;
                 }              
              temp=min;
              }