p->next=NULL; TQL.rear->next=p; TQL.rear=p; }
FinalStu DeTempQueue(TempQList &TQL) { FinalStu stu; TempQueue *p; p=TQL.front->next; if(p==TQL.rear) { stu=p->stu; TQL.rear=TQL.front; } else { stu=p->stu; TQL.front->next=p->next; } free(p); return stu; }
//==========配对信息存放=================== struct MatchList { char musicName[20]; FinalStu stu[2]; };
MatchList matchTable[SIZE]; //从键盘读入学生信息 void GetInfKey() { for(int i=0;i //学生入座 void StudentSit() { 20 for(int i=0;i //获取就坐后的男女生性别、姓名、编号,stuSeat[] 存放就坐后的学生信息,包括学生编号 void GetStuSeat() { int i=0; int j=0; i=Boys.front; j=Girls.front; while(i!=Boys.rear) { stuSeat[i]=Boys.base[i]; i++; } while(j!=Girls.rear) { stuSeat[i]=Girls.base[j]; j++; i++; } } //将就座的学生信息写入文件 int InFileStuSeat() { FILE *fp_Seat; int res=0; if((fp_Seat=fopen(\,\))==NULL) { cout<<\读取学生座位信息失败!!!\; return -1; } fprintf(fp_Seat,\姓名\\t性别\\t序号\\n\); for(int i=0;i 21 fprintf(fp_Seat,\); res++; } fclose(fp_Seat); return res; } void PrintStuSeat() { cout<<\姓名\\t性别\\t序号\< //从文件中获取管理员信息 void ReadAdmin() { admin=(Admin*)malloc(sizeof(Admin)); admin->next=NULL; Admin *q=admin; FILE *fp_Admin; if((fp_Admin=fopen(\,\))==NULL) { cout<<\打开文件失败!!!\; return; } while(!feof(fp_Admin)) { Admin *p=(Admin *)malloc(sizeof(Admin)); p->next=NULL; fscanf(fp_Admin,\,p->name,p->passWord); q->next=p; q=p; } fclose(fp_Admin); } //从文件获取学生信息 void ReadStuFile(int res) { FILE *fp; if(res==1) { 22 if((fp=fopen(\,\))==NULL) { cout<<\打开文件失败!!!\< //加载音乐信息 int LoadMusic(int cd) { char music[5][20]; //存放从文件中获取的音乐名称 int res=0; FILE *fp_music; if(cd==1) { if((fp_music=fopen(\,\))==NULL) { cout<<\打开音乐文件失败!!!\< 23 } } for(int j=0;j<5;j++) { if(fread(music[j],20*sizeof(char),1,fp_music)==1) res++; } fclose(fp_music); InitMusic(ML); for(int i=0;i<5;i++) { InsertMusic(ML,music[i]); } return res; } int InFileMatchTable() { FILE *fp_MTable; if((fp_MTable=fopen(\,\))==NULL) { cout<<\打开文件失败~~~~\< void StudentSitAgain() { FinalStu stu; while(TempQL.front!=TempQL.rear) { 24