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

2020-01-06 13:21:41王冬梅
  • getchar();  getchar(); 
  • system("cls");  menu_select(); 
  • }  int num; 
  • Stu * st=(Stu *)malloc(sizeof(Stu));  traverse_List(pHead); 
  • cout<<endl<<"请输入您要删除的记录的序号:";  cin>>num; 
  • if(delete_List(pHead,num,st))  { 
  • cout<<endl<<"成功删除的记录如下:"<<endl;  cout<<"学号:"<<st->no<<endl<<"姓名:"<<st->name<<endl; 
  • }  else 
  • {  cout<<"删除失败!"<<endl; 
  • }  getchar(); 
  • getchar();  system("cls"); 
  • menu_select();  break; 
  • }  case 8: 
  • {  if(NULL!=pHead) 
  • {  system("cls"); 
  • cout<<"记录总条数:"<<length_List(pHead)<<"条"<<endl;  getchar(); 
  • getchar();  system("cls"); 
  • menu_select();  } 
  • else  { 
  • cout<<"记录总条数为零"<<endl;  getchar(); 
  • getchar();  system("cls"); 
  • menu_select();  } 
  • break;  } 
  • case 9:  { 
  • system("cls");  cout<<"成功退出!"<<endl; 
  • exit(0);  break; 
  • }  } 
  • }   
  •   void delFile() 
  • {  ofstream fileout; 
  • fileout.open("c:kcsj.txt",ios_base::out);  fileout<<""; 
  • fileout.close();  } 
  •    
  • Student * inFile()  { 
  • Student * pHead=(Student *)malloc(sizeof(Student));  if(NULL==pHead) 
  • {  cout<<"分配失败,程序终止!"<<endl; 
  • exit(0);  } 
  • Student * pTail=pHead;  pTail->next=NULL; 
  • ifstream in("c:kcsj.txt");  if (!in.is_open())