大学院情報管理システム(C言語コースデザイン)



Postgraduate Information Management System



#include #include #include #include #include #include #include #pragma comment(lib, 'Winmm.lib') #define len sizeof(struct ADJ) typedef struct ADJ { long xuehao,jxueji char name[20],daoshi[20] ,zhuanye[30],xianjiufx[50],sushe[10] char sex[10] struct ADJ *next }stu stu head//Define the head node as a global variable void displayMenu()//Display menu int menuchoose()//Get user menu selection stu *getupaddr(long xuehao) //Return to the previous node pointer of the specified student number stu * creat()//Create a node int add(stu *p1)//Add the node to the linked list void displayall()//Display all information int rencount()//Count the total number of people void xiugai(stu *p)//Modify information stu * xhaofind(long xh)//Search by student ID and return to the previous node pointer of the student ID int question(const char *pstr)//Get judgment void del(stu *p)//delete message void choose(int n)//Function selection void delall()//Delete all postgraduate information int display(stu *p)//Single display void Load()//Load data void Save()//Save information to file stu *namefind(char *mz)//Search by name, return the previous node pointer of the searched name void daos(char *dao)//Find by tutor void sefind(char *se)//Search by dormitory number void xhaorank()//Bubble sort method void namerank()//Sort by first letter of name void daosrank()//Sorted by the first letter of the tutor void zyrank()//Sorted by first letter of major void yecount()//According to professional statistics void dscount()//Statistics scholarship by tutor void yemoney()//Statistical Scholarship by Major void home()//Welcome Screen void login()//Login verification void music()//play music void offmusic()//Turn off the music void tui()//Exit the sound effect void hello()//Greeting void dqsj()//Display the current time int main() { hello() home() login() choose(menuchoose()) return 0 } void choose(int n)//Function selection { int count=0,a//a is the selection variable char mz[20],dao[20],se[10] long b while(1) { switch(n) { case 1:Load()system('pause')choose(menuchoose())break//Load information case 2:displayall()rencount()//Display all information if(question('Do you want to return to the main menu?')) choose(menuchoose())break case 3:do//add information { add(creat()) count++ }while(question('Do you want to continue typing?')) printf('A total of %d messages have been added! ',count) if(question('Do you want to return to the main menu?')) choose(menuchoose())break case 4:printf('How do you search? 1 is the student ID search, 2 is the name search, 3 is the tutor search, 4 is the dormitory number search Your choice is:')//Finding information fflush(stdin)//Empty the input buffer scanf('%d',&a) while(a!=1&&a!=2&&a!=3&&a!=4)//Prevent input errors { printf('Your input is incorrect, please re-enter:') scanf('%d',&a) fflush(stdin)//Empty the input buffer } if(a==1)//Student ID search { printf('Please enter the student ID you are looking for:') scanf('%ld',&b) if(display(xhaofind(b))) { printf('What do you want to do with this data? ') printf('1Delete 2Modify 3Return to the main menu Please make your choice:') } else { if(question('Do you want to return to the main menu?')) choose(menuchoose()) else choose(4) } fflush(stdin)//Empty the input buffer scanf('%d',&a) while(a!=1&&a!=2&&a!=3)//Prevent input errors { printf('Your input is incorrect, please re-enter:') scanf('%d',&a) fflush(stdin)//Empty the input buffer } if(a==1)//Delete the information { del(xhaofind(b)) if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else if(a==2)//Modify the information { xiugai(xhaofind(b)) if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else//Return to the main menu choose(menuchoose()) } else if(a==2)//Name search { printf('Please enter the name you are looking for:') scanf('%s',mz) if(display(namefind(mz)))//Determine whether the information exists { printf('What do you want to do with this data? ') printf('1Delete 2Modify 3Return to the main menu Please make your choice:') } else { if(question('Do you want to return to the main menu?')) choose(menuchoose()) else choose(4) } fflush(stdin)//Empty the input buffer scanf('%d',&a) while(a!=1&&a!=2&&a!=3)//Prevent input errors { printf('Your input is incorrect, please re-enter:') scanf('%d',&a) fflush(stdin)//Empty the input buffer } if(a==1)//delete { del(namefind(mz)) if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else if(a==2)//modify { xiugai(namefind(mz)) if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else//Return to the main menu choose(menuchoose()) } else if(a==3)//Find by tutor { printf('Please enter the name of the tutor you are looking for:') scanf('%s',dao) daos(dao)if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else { printf('Please enter the dormitory number you are looking for:') scanf('%s',se) sefind(se)if(question('Do you want to return to the main menu?')) choose(menuchoose()) } break case 5:printf('How do you sort? 1 Sort by student number, 2 sort by name, 3 sort by tutor, 4 sort by major Your choice is:') fflush(stdin)//Empty the input buffer scanf('%d',&a) while(a!=1&&a!=2&&a!=3&&a!=4) { printf('Your input is incorrect, please re-enter:') scanf('%d',&a) fflush(stdin)//Empty the input buffer } if(a==1) { xhaorank()choose(2) } else if(a==2) { namerank()choose(2) } else if(a==3) { daosrank()choose(2) } else zyrank()choose(2) break case 6:printf('How do you count? 1 count the number of people by profession, 2 count the total amount of scholarships by tutors, 3 count the total amount of scholarships by majors Your choice is:') scanf('%d',&a) while(a!=1&&a!=2&&a!=3)//Prevent input errors { printf('Your input is incorrect, please re-enter:') scanf('%d',&a) fflush(stdin)//Empty the input buffer } if(a==1) { yecount()if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else if(a==2) { dscount()if(question('Do you want to return to the main menu?')) choose(menuchoose()) } else yemoney()if(question('Do you want to return to the main menu?')) choose(menuchoose()) break case 7:delall()if(question('Do you want to return to the main menu?')) choose(menuchoose())break case 8:Save()if(question('Do you want to return to the main menu?')) choose(menuchoose())break case 9:if(question('Are you sure you want to exit? Please check whether the data has been saved before exiting?')) {system('cls')home() printf('Thank you for using the Graduate Information Management System, goodbye! ') printf(' Thank you for using the Graduate Information Management System. Good-bye. ') tui() getch()exit(0)}choose(menuchoose())break case 10:if(question('Are you sure you want to play background music?')) music() choose(menuchoose()) case 11:if(question('Are you sure you want to turn off the background music?')) offmusic() choose(menuchoose()) default:break } } } void displayMenu()//Display menu { system('cls') printf('----------------------------Graduate Information Management System----------------- --------------- ') printf(' 1. Read information file 2. Display all information 3. Add information ') printf(' 4. Find graduate students 5. Sort 6. Statistics ') printf(' 7. Delete all information 8. Save the information to a file 9. Exit the system ') printf(' 10. Play background music 11. Turn off background music ') printf(' ------------------------------------------------------------------------------- ') dqsj() } int menuchoose()//Get user menu selection { int menu displayMenu() printf('Please select the menu and enter the numbers 1-11: ') scanf('%d',&menu) while(menu<1||menu>11)//Judge whether the output is correct { displayMenu() printf('Selection error! Please re-enter: ') fflush(stdin)//Empty the input buffer scanf('%d',&menu) } return(menu) } stu * creat()//Create a node { stu *p p=(stu *)malloc(len) if(!p) { printf('Failed to apply for space!!! ') return NULL } else printf('Please enter student ID:') while(1!=scanf('%ld',&p->xuehao)||getupaddr(p->xuehao)) { printf('Input error or the student ID already exists, please re-enter: ') fflush(stdin) } printf('Please type in your name:') scanf('%20s',p->name) printf('Please enter gender:') scanf('%s',p->sex) printf('Please enter the name of the tutor:') scanf('%s',p->daoshi) printf('Please enter the professional name:') scanf('%s',p->zhuanye) printf('Please enter research direction:') scanf('%s',p->xianjiufx) printf('Please enter the scholarship amount (integer):') scanf('%ld',&p->jxueji) printf('Please enter dormitory information:') scanf('%s',p->sushe) p->next=NULL return(p) } stu *getupaddr(long xuehao) //Return to the previous node pointer of the specified student number { stu *p=&head while(p->next) { if(p->next->xuehao==xuehao) return(p) p=p->next } return(NULL) } int add(stu *p1)//Add the node to the linked list { stu *pt=&head if(!p1)//Determine whether it is an empty node return 0 if(getupaddr(p1->xuehao))//Determine whether the graduate student information exists { printf('The information of the graduate student whose student ID is %ld already exists! ',p1->xuehao) free(p1)//Release the memory of the node return 0 } while(pt->next)//Move the pointer to the last node pt=pt->next pt->next=p1 p1->next=NULL return 1 } void displayall()//Display all information { stu *p2=&head if(p2->next) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') while(p2->next) { printf('%-12d',p2->next->xuehao) printf('%-8s',p2->next->name) printf('%-5s',p2->next->sex) printf('%-8s',p2->next->daoshi) printf('%-20s',p2->next->zhuanye) printf('%-24s',p2->next->xianjiufx) printf('%-8d',p2->next->jxueji) printf('%-10s ',p2->next->sushe) p2=p2->next } printf('------------------------------------------------------------------------------------------------- ') } else printf('The current information is empty, please load a file or enter information!!! ') } int rencount()//Count the total number of people { int count=0 stu *p=&head while(p->next) { count++ p=p->next } printf(' There are currently %d postgraduate information. ',count) return(count) } stu * xhaofind(long xh)//Search by student ID and return the previous node pointer of the student ID { stu *p=getupaddr(xh)//Get the last node to find student ID if(!p) { printf('There is no graduate student with student ID %ld ',xh) return(NULL) } else return(p) } void xiugai(stu *p1)//Modify information { stu *temp if(question('Do you want to re-enter the graduate student information?')) { temp=p1->next p1->next=temp->next free(temp) add(creat()) printf('Modified successfully! ') } else printf('Modification failed!! ') } int question(const char *pstr)//Get judgment { char answer printf('%s please select (y or n):', pstr) while(1 != scanf(' %c', &answer) || (answer != 'y' && answer != 'n')) { printf('Input error! Please select again (y or n):') fflush(stdin)//Empty the input buffer } if('y' == answer) return 1 else return 0 } void del(stu *p)//delete message { stu *temp if(!question('Are you sure you want to delete the postgraduate information?')) printf('failed to delete!!') else { temp=p->next p->next=temp->next free(temp) printf('successfully deleted!') } } void delall()//Delete all postgraduate information { stu *p=head.next,*temp int count=0 if(!question('Are you sure you want to delete all current postgraduate information?')) printf('Deletion failed!! ') else { while(p) { temp=p p=p->next free(temp) ++count } head.next=NULL printf('A total of %d graduate students have been deleted! ',count) } } int display(stu *p)//Single display { if(p) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') printf('%-12d',p->next->xuehao) printf('%-8s',p->next->name) printf('%-5s',p->next->sex) printf('%-8s',p->next->daoshi) printf('%-20s',p->next->zhuanye) printf('%-24s',p->next->xianjiufx) printf('%-8d',p->next->jxueji) printf('%-10s ',p->next->sushe) printf('------------------------------------------------------------------------------------------------- ') return 1 } return 0 } stu *namefind(char *mz)//Search by name, return the previous node pointer of the searched name { stu *p=&head while(p->next) { if(0==strcmp(p->next->name,mz)) return(p) p=p->next } printf('The postgraduate information named %s does not exist! ',mz) return NULL } void daos(char *dao)//Find by tutor { stu *p2=&head int i=0 if(p2->next) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') while(p2->next) { if(strcmp(p2->next->daoshi,dao)==0) { printf('%-12d',p2->next->xuehao) printf('%-8s',p2->next->name) printf('%-5s',p2->next->sex) printf('%-8s',p2->next->daoshi) printf('%-20s',p2->next->zhuanye) printf('%-24s',p2->next->xianjiufx) printf('%-8d',p2->next->jxueji) printf('%-10s ',p2->next->sushe) i++ } p2=p2->next } if(!i) printf('There is no information for this graduate student ') else { printf('------------------------------------------------------------------------------------------------- ') printf('A total of %d graduate students with a major of %s ',dao,i) printf(' ') printf(' ') } } else printf('The current information is empty, please load a file or enter information!!! ') } void sefind(char *se)//Search by dormitory number { stu *p2=&head int i=0 if(p2->next) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') while(p2->next) { if(strcmp(p2->next->sushe,se)==0) { printf('%-12d',p2->next->xuehao) printf('%-8s',p2->next->name) printf('%-5s',p2->next->sex) printf('%-8s',p2->next->daoshi) printf('%-20s',p2->next->zhuanye) printf('%-24s',p2->next->xianjiufx) printf('%-8d',p2->next->jxueji) printf('%-10s ',p2->next->sushe) i++ } p2=p2->next } if(!i) printf('There is no information for this graduate student ') else { printf('------------------------------------------------------------------------------------------------- ') printf('The graduate student with the dormitory number %s has %d people ',se,i) printf(' ') printf(' ') } } else printf('The current information is empty, please load a file or enter information!!! ') } void Load()//Load data { int i, count = 0, repeat = 0 FILE *pf stu *pstu printf('Prompt: Reading the postgraduate information from the file will ask whether to clear the current postgraduate information (not clearing means to merge all the information). ') if((pf = fopen('xsx.dat', 'rb')) == NULL) { printf('The current information is empty, please load a file or enter information!!! ') if(question('Do you want to return to the main menu?')) choose(menuchoose()) exit(0) } delall()//Delete all previous student information, and then read from the file fread(&count, 1, sizeof count, pf)//Get the number of student information for(i = 0i<counti++) { pstu = (stu *)malloc(len) fread(pstu, 1, sizeof(stu), pf) if(!add(pstu)) { ++repeat//How many duplicate student information is kept in the current linked list } } fclose(pf) printf('File reading completed! Newly added %d postgraduate information. ', count - repeat) } void Save()//Save information to file { FILE *pf=fopen('xsx.dat','wb') stu *pstu = &head int i = 0, count = rencount() if(!pf) { printf('Failed to open the file to be written! ') system('pause') fclose(pf) exit(0) } if(question('Are you sure you want to save?')) { fwrite(&count, 1, sizeof(count), pf)//Write the number of student information into the file header first while(pstu->next) { fwrite(pstu->next, 1, sizeof(stu), pf)//Write each student's information into the file ++i pstu = pstu->next } fclose(pf) if(i == count) { printf('Successfully wrote %d student information. ', count) } else { printf('%D student information should be written, %d student information should actually be written. ', count, i) } } else choose(menuchoose()) } void xhaorank()//Student number bubble sorting method { stu *cur,*tail cur=head.next tail=NULL if(cur==NULL||cur->next==NULL) return while(cur!=tail) { while(cur->next!=tail) { if(cur->xuehao>cur->next->xuehao) { long temp=cur->xuehao,jxj char n[20],s[10],ds[20],yfx[50],shue[10],zy[30] cur->xuehao=cur->next->xuehao cur->next->xuehao=temp strcpy(n,cur->name) strcpy(cur->name,cur->next->name) strcpy(cur->next->name,n) strcpy(s,cur->sex) strcpy(cur->sex,cur->next->sex) strcpy(cur->next->sex,s) strcpy(ds,cur->daoshi) strcpy(cur->daoshi,cur->next->daoshi) strcpy(cur->next->daoshi,ds) strcpy(zy,cur->zhuanye) strcpy(cur->zhuanye,cur->next->zhuanye) strcpy(cur->next->zhuanye,zy) strcpy(yfx,cur->xianjiufx) strcpy(cur->xianjiufx,cur->next->xianjiufx) strcpy(cur->next->xianjiufx,yfx) jxj=cur->jxueji cur->jxueji=cur->next->jxueji cur->next->jxueji=jxj strcpy(shue,cur->sushe) strcpy(cur->sushe,cur->next->sushe) strcpy(cur->next->sushe,shue) } cur=cur->next } tail=cur cur=head.next } } void namerank()//Sort by first letter of name { stu *cur,*tail cur=head.next tail=NULL if(cur==NULL||cur->next==NULL) return while(cur!=tail) { while(cur->next!=tail) { if(strcmp(cur->name,cur->next->name)>0) { long temp=cur->xuehao,jxj char n[20],s[10],ds[20],yfx[50],shue[10],zy[30] cur->xuehao=cur->next->xuehao cur->next->xuehao=temp strcpy(n,cur->name) strcpy(cur->name,cur->next->name) strcpy(cur->next->name,n) strcpy(s,cur->sex) strcpy(cur->sex,cur->next->sex) strcpy(cur->next->sex,s) strcpy(ds,cur->daoshi) strcpy(cur->daoshi,cur->next->daoshi) strcpy(cur->next->daoshi,ds) strcpy(zy,cur->zhuanye) strcpy(cur->zhuanye,cur->next->zhuanye) strcpy(cur->next->zhuanye,zy) strcpy(yfx,cur->xianjiufx) strcpy(cur->xianjiufx,cur->next->xianjiufx) strcpy(cur->next->xianjiufx,yfx) jxj=cur->jxueji cur->jxueji=cur->next->jxueji cur->next->jxueji=jxj strcpy(shue,cur->sushe) strcpy(cur->sushe,cur->next->sushe) strcpy(cur->next->sushe,shue) } cur=cur->next } tail=cur cur=head.next } } void daosrank()//Sorted by the first letter of the tutor { stu *cur,*tail cur=head.next tail=NULL if(cur==NULL||cur->next==NULL) return while(cur!=tail) { while(cur->next!=tail) { if(strcmp(cur->daoshi,cur->next->daoshi)>0) { long temp=cur->xuehao,jxj char n[20],s[10],ds[20],yfx[50],shue[10],zy[30] cur->xuehao=cur->next->xuehao cur->next->xuehao=temp strcpy(n,cur->name) strcpy(cur->name,cur->next->name) strcpy(cur->next->name,n) strcpy(s,cur->sex) strcpy(cur->sex,cur->next->sex) strcpy(cur->next->sex,s) strcpy(ds,cur->daoshi) strcpy(cur->daoshi,cur->next->daoshi) strcpy(cur->next->daoshi,ds) strcpy(zy,cur->zhuanye) strcpy(cur->zhuanye,cur->next->zhuanye) strcpy(cur->next->zhuanye,zy) strcpy(yfx,cur->xianjiufx) strcpy(cur->xianjiufx,cur->next->xianjiufx) strcpy(cur->next->xianjiufx,yfx) jxj=cur->jxueji cur->jxueji=cur->next->jxueji cur->next->jxueji=jxj strcpy(shue,cur->sushe) strcpy(cur->sushe,cur->next->sushe) strcpy(cur->next->sushe,shue) } cur=cur->next } tail=cur cur=head.next } } void zyrank()//Sorted by major { stu *cur,*tail cur=head.next tail=NULL if(cur==NULL||cur->next==NULL) return while(cur!=tail) { while(cur->next!=tail) { if(strcmp(cur->zhuanye,cur->next->zhuanye)>0) { long temp=cur->xuehao,jxj char n[20],s[10],ds[20],yfx[50],shue[10],zy[30] cur->xuehao=cur->next->xuehao cur->next->xuehao=temp strcpy(n,cur->name) strcpy(cur->name,cur->next->name) strcpy(cur->next->name,n) strcpy(s,cur->sex) strcpy(cur->sex,cur->next->sex) strcpy(cur->next->sex,s) strcpy(ds,cur->daoshi) strcpy(cur->daoshi,cur->next->daoshi) strcpy(cur->next->daoshi,ds) strcpy(zy,cur->zhuanye) strcpy(cur->zhuanye,cur->next->zhuanye) strcpy(cur->next->zhuanye,zy) strcpy(yfx,cur->xianjiufx) strcpy(cur->xianjiufx,cur->next->xianjiufx) strcpy(cur->next->xianjiufx,yfx) jxj=cur->jxueji cur->jxueji=cur->next->jxueji cur->next->jxueji=jxj strcpy(shue,cur->sushe) strcpy(cur->sushe,cur->next->sushe) strcpy(cur->next->sushe,shue) } cur=cur->next } tail=cur cur=head.next } } //Welcome Screen****************************** float f(float x, float y, float z) { float a a = x * x + 9.0f / 4.0f * y * y + z * z - 1 return a * a * a - x * x * z * z * z - 9.0f / 80.0f * y * y * z * z * z } float h(float x, float z) { float y for ( y = 1.0f y >= 0.0f y -= 0.001f) if (f(x, y, z) <= 0.0f) return y return 0.0f} void home()//Welcome Screen { float z,x,v,y0,ny,nx,nz,nd,d for ( z = 1.5f z > -1.5f z -= 0.05f) { for ( x = -1.5f x < 1.5f x += 0.025f) { v = f(x, 0.0f, z) if (v <= 0.0f) { y0 = h(x, z) ny = 0.01f nx = h(x + ny, z) - y0 nz = h(x, z + ny) - y0 nd = 1.0f / sqrtf(nx * nx + ny * ny + nz * nz) d = (nx + ny - nz) * nd * 0.5f + 0.5f putchar('.:-=+*#%@'[(int)(d * 5.0f)]) } else putchar(' ') } putchar(' ') } } //******************************************** void login()//Login verification { int i=3,j=0 char password1[20]='201821111134', user[20],password[20] char user1[20]={'Xu Shixing'},ch char password2[20]='201821111138',user2[20]={'Li Jinxuan'} printf('Welcome to postgraduate information management system ') printf(' Welcome to Postgraduate Information Management System ') printf(' Please enter your username:') scanf('%s',user) while(!(strcmp(user1,user)==0||strcmp(user2,user)==0)) { printf('The username does not exist, please re-enter! You still have %d chances. ',i) printf('Please re-enter:') scanf('%s',user) i-- if(!i) { system('cls')home() printf('Thank you for using the Graduate Information Management System, goodbye! ') printf(' Thank you for using the Graduate Information Management System. Good-bye. ') getch()exit(0) } } printf(' please enter your password:') ch=getch() while(ch!=' '||ch=='') { if(ch!='') { password[j]=ch printf('*')j++ } else { j-=1 printf('') printf(' ') printf('') } ch=getch() } i=3 while(!(strcmp(password1,password)==0||strcmp(password2,password)==0)) { printf(' The password is wrong, please re-enter! You still have %d chances. ',i) printf('Please re-enter:') ch=getch() j=0 while(ch!=' '||ch=='') { if(ch!='') { password[j]=ch printf('*')j++ } else { j-=1 printf('') printf(' ') printf('') } ch=getch() } i-- if(!i) { system('cls')home() printf('Thank you for using the Graduate Information Management System, goodbye! ') printf(' Thank you for using the Graduate Information Management System. Good-bye. ') getch()exit(0) } } } void yecount()//According to professional statistics { stu *p2=&head int i=0 zyrank() if(p2->next) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') while(p2->next) { i++ printf('%-12d',p2->next->xuehao) printf('%-8s',p2->next->name) printf('%-5s',p2->next->sex) printf('%-8s',p2->next->daoshi) printf('%-20s',p2->next->zhuanye) printf('%-24s',p2->next->xianjiufx) printf('%-8d',p2->next->jxueji) printf('%-10s ',p2->next->sushe) if(!p2->next->next) { printf('------------------------------------------------------------------------------------------------- ') printf('The number of graduate students whose major is %s is %d ',p2->next->zhuanye,i) break } if(strcmp(p2->next->zhuanye,p2->next->next->zhuanye)!=0) { printf('------------------------------------------------------------------------------------------------- ') printf('The number of graduate students whose major is %s is %d ',p2->next->zhuanye,i) printf(' ') printf(' ') printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') i=0 } p2=p2->next } printf(' ') printf(' ') printf('------------------------------------------------------------------------------------------------- ') } else printf('The current information is empty, please load a file or enter information!!! ') } void dscount()//Statistics scholarship by tutor { stu *p2=&head int i=0 daosrank() if(p2->next) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') while(p2->next) { printf('%-12d',p2->next->xuehao) printf('%-8s',p2->next->name) printf('%-5s',p2->next->sex) printf('%-8s',p2->next->daoshi) printf('%-20s',p2->next->zhuanye) printf('%-24s',p2->next->xianjiufx) printf('%-8d',p2->next->jxueji) printf('%-10s ',p2->next->sushe) i+=p2->next->jxueji if(!p2->next->next) { printf('------------------------------------------------------------------------------------------------- ') printf('The total number of postgraduate scholarships with a supervisor as %s is %d yuan ',p2->next->daoshi,i) break } if(strcmp(p2->next->daoshi,p2->next->next->daoshi)!=0) { printf('------------------------------------------------------------------------------------------------- ') printf('The total number of postgraduate scholarships with a supervisor as %s is %d yuan ',p2->next->daoshi,i) printf(' ') printf(' ') printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') i=0 } p2=p2->next } printf(' ') printf(' ') printf('------------------------------------------------------------------------------------------------- ') } else printf('The current information is empty, please load a file or enter information!!! ') } void yemoney()//Statistical Scholarship by Major { stu *p2=&head int i=0 zyrank() if(p2->next) { printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') while(p2->next) { printf('%-12d',p2->next->xuehao) printf('%-8s',p2->next->name) printf('%-5s',p2->next->sex) printf('%-8s',p2->next->daoshi) printf('%-20s',p2->next->zhuanye) printf('%-24s',p2->next->xianjiufx) printf('%-8d',p2->next->jxueji) printf('%-10s ',p2->next->sushe) i+=p2->next->jxueji if(!p2->next->next) { printf('------------------------------------------------------------------------------------------------- ') printf('The total number of postgraduate scholarships for %s is %d yuan ',p2->next->zhuanye,i) break } if(strcmp(p2->next->zhuanye,p2->next->next->zhuanye)!=0) { printf('------------------------------------------------------------------------------------------------- ') printf('The total number of graduate scholarships with a major of %s is %d yuan ',p2->next->zhuanye,i) printf(' ') printf(' ') printf('------------------------------------------------------------------------------------------------- ') printf('Student ID Name Gender Tutor Major Research Direction Scholarship Dormitory Information ') printf('------------------------------------------------------------------------------------------------- ') i=0 } p2=p2->next } printf(' ') printf(' ') printf('------------------------------------------------------------------------------------------------- ') } else printf('The current information is empty, please load a file or enter information!!! ') } void music()//play music SND_LOOP) void offmusic()//Turn off the music PlaySound(NULL, NULL, SND_FILENAME void hello()//Greeting SND_ASYNC) void tui()//Exit the sound effect SND_SYNC) void dqsj()//Display the current time { char * wday[] = {'on Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'on Saturday'} time_t t struct tm *p t = time(NULL) p = gmtime(&t) printf('The time is now:') printf('%d year%2d month%2d day', (1900+p->tm_year), (1+p->tm_mon), p->tm_mday) printf(' %s ', wday[p->tm_wday]) printf('%02d:%02d ', (8+p->tm_hour), p->tm_min) printf(' ------------------------------------------------------------------------------- ') }