C++实现简单的学生管理系统

2020-01-06 13:21:41王冬梅
  • }   
  • bool delete_List(Student * pHead,int position,Stu * st)  { 
  • int i=0;  Student * p=pHead; 
  •   while(NULL!=p->next&&i<position-1) 
  • {  p=p->next; 
  • i++;  } 
  • Student * q=p->next;  *st=q->getst(); 
  • p->next=p->next->next;  free(q); 
  • q=NULL;  return true; 
  • }   
  • void sort_List(Student * pHead)  { 
  • Student * p,* q;  Stu temp; 
  • int i,j;  int len=length_List(pHead); 
  • for(i=0,p=pHead->next;i<len-1;i++,p=p->next)  { 
  • for(j=i+1,q=p->next;j<len;j++,q=q->next)  { 
  • if(q->st.ave>p->st.ave)  { 
  • temp=q->st;  q->st=p->st; 
  • p->st=temp;  } 
  • }  }  
  • 以上所述就是本文的全部内容了,希望大家能够喜欢。