C++學(xué)生信息管理系統(tǒng)
本文實(shí)例為大家分享了C++學(xué)生信息管理系統(tǒng)源碼,供大家參考,具體內(nèi)容如下
1. tea_list.c
#include<stdio.h> #include<stdlib.h> #include<string.h> #include"teacher.h" int sq_tea ; PTEA head = NULL ; FILE *fp ; int tea_llopen(const char* path)//打開文件 { fp=fopen(path,"r"); if(fp==NULL){ perror("open fail"); return -1;} #ifdef DEBUG printf ("debug--001") ; #endif PTEA p; int ret; while(p) { p=malloc(sizeof(TEA)); if(p==NULL){ perror("申請(qǐng)空間不夠"); return -1;} ret=fscanf(fp,"%d%d%d%s%s", &p->id,&p->age,&p->wages,p->name,p->passwd); if(ret<=0) break; if(head==NULL){ p->next=NULL; p->pre=NULL; head=p;} else{ p->next=head; p->pre=NULL; head->pre=p; head=p;} } return 0; } #if 1 int tea_llshow( )//顯示 { if(head==NULL) return -1; PTEA p=head; printf("工號(hào)\t年齡\t工資\t姓名\n"); while(p) { printf("%d\t%d\t%d\t%s\n", p->id,p->age,p->wages,p->name); p=p->next; } return 0; } PTEA tea_llcheck(PTEA a)//查找 { printf("輸入查找教師工號(hào)\n"); int id; scanf("%d",&id); while(getchar()!='\n'); PTEA p; p=head; while(p) { if(p->id==id){ printf ("工號(hào)\t年齡\t薪水\t姓名\n " ); printf ("%d\t%d\t%d\t%s\n",p->id,p->age,p->wages,p->name); break ; } p=p->next; } if (p==NULL) { printf ("未找到該教師\n"); printf ("是否繼續(xù)查找y/n\n") ; char ch ; getchar(); ch=getchar(); if((ch=='y')||(ch=='Y')) tea_llcheck (p ) ; else return NULL ; } return 0; } #endif #if 1 int tea_lladd(PTEA b )//增加老師信息 { #ifdef _DEBUG_ printf ("debug-001\n") ; #endif PTEA p ; char ch ; p=malloc(sizeof(TEA)); if(p==NULL){ perror("申請(qǐng)空間不夠\n"); return -1;} printf ("請(qǐng)輸入添加老師的信息\n工號(hào)\t年齡\t薪水\t姓名\t密碼\n") ; scanf("%d%d%d%s",&p->id,&p->age,&p->wages,p->name,p->passwd) ; while(getchar()!='\n'); if ( p == NULL ) return -1 ; if ( head == NULL ) //說明鏈表為空,加入成第一個(gè) { p->next = NULL ; p->pre = NULL ; head->pre = p ; head = p ; } else { p->next=head ; p->pre=NULL ; head->pre = p ; head=p ; } /* fprintf ( fp , "%d\t%d\t%d\t%s\n",p->id,p->age,p->wages,p->name ) ; fclose ( fp ) ; fopen ("teacher.txt" , "a+"); */ return 0 ; } #endif #if 1 int tea_lldelete( PTEA a ) //刪除老師 { int key ; printf ("請(qǐng)輸入要?jiǎng)h除的老師的工號(hào)\n") ; scanf ("%d",&key); while(getchar()!='\n'); PTEA p ; PTEA q ; p = head ; while (p) { if (p->id == key ) { if( (p == head)&&(head->next!=NULL) ) { head = head->next ; head->pre = NULL ; #ifdef _DEBUG_ printf ("case 1\n") ; #endif } else if ((p==head) && ( head->next==NULL)) { head = NULL ; #ifdef _DEBUG_ printf ("case 2\n") ; #endif } else if( (p!=head )&&(p->next!=NULL) ) {p->pre->next=p->next ; p->next->pre = p->pre ; #ifdef _DEBUG_ printf ("case 3\n ") ; I #endif } else { p->pre->next = NULL ; #ifdef _DEBUG_ printf ("case 4\n") ; #endif } break ; } p = p->next ; } free (p) ; if (p==NULL) printf ("未找到該教師") ; /* fp = fopen("teacher.txt","r+"); while(p){ fprintf (fp ," %d\t%d\t%d\t%s\n" , p->id , p->age ,p->wages , p->name ); p=p->next ; } fclose (fp) ; tea_llopen ; */ } #endif #if 1 int tea_llchange()//修改老師信息 { PTEA p; printf("\n輸入工號(hào)"); int key; scanf("%d",&key); while(getchar()!='\n'); p=head; while(p) { if(p->id==key){ printf("工號(hào)\t年齡\t薪水\t姓名\n"); scanf("%d%d%d%s%s", &p->id,&p->age,&p->wages,p->name,p->passwd); while(getchar()!='\n'); break ; } p=p->next;} p = head ; printf ("修改之后為\n"); printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t班級(jí)\t姓名\t密碼\n"); while(p) { printf("%d\t%d\t%d\t%s\t%s\n", p->id,p->age,p->wages,p->name,p->passwd); p=p->next; } return 0; } #endif #if 1 PTEA tea_check_id() //校驗(yàn)老師用戶名 { PTEA p; p = head; int id; char ch; printf("請(qǐng)輸入您的工號(hào):"); scanf("%d",&id); while(getchar()!='\n'); while(p) { if(p->id==id){ return p; } p = p->next; } if(p==NULL){ printf("找不到該用戶\n"); printf("是否重試?[y/n]\n"); // scanf("%c",&ch) ; // getchar () ; ch = getchar () ; if ((ch=='y')||(ch=='Y')) tea_check_id(); else menu(); } } #endif #if 1 PTEA tea_check_passwd() //校驗(yàn)老師密碼 { PTEA p; p =tea_check_id(); char passwd[20]; char ch; printf("請(qǐng)輸入密碼:"); scanf("%s",passwd); while(getchar()!='\n'); if(strcmp (p->passwd , passwd)==0) { sq_tea = p->id ; #ifdef _DEBUG_ printf("================%d\n",p->id) ; printf("================%d\n",sq_tea) ; getchar(); getchar(); #endif return p; }else{ printf("密碼不正確\n"); printf("是否重新輸入[y/n]\n"); // getchar() ; ch = getchar () ; while(getchar()!='\n'); if((ch=='y')||(ch=='Y')) tea_check_passwd(); else menu(); } return NULL; } #endif #if 1 int tea_change_passwd() { PTEA p; p=tea_check_passwd(); char new_passwd[20]; char new[20]; char ch; printf("請(qǐng)輸入新密碼:"); scanf("%s",new_passwd); while(getchar() != '\n'); printf("請(qǐng)?jiān)俅屋斎胄旅艽a:"); scanf("%s",new); while(getchar() != '\n'); if(strcmp(new_passwd,new)==0) { strcpy(p->passwd,new_passwd) ; printf("密碼修改成功!\n"); // tea_write() ; } else { printf("密碼輸入錯(cuò)誤\n"); printf("是否重試[y/n]\n"); // getchar(); ch=getchar() ; while(getchar()!='\n'); if((ch=='y')||(ch=='Y')) tea_change_passwd(); else exit(1); } return 0; } #endif #if 1 int tea_lookme() { PTEA p; p = head ; while (p) { if( p->id == sq_tea ) { printf("工號(hào)\t年齡\t薪水\t姓名\t密碼\n"); printf("%d\t%d\t%d\t%s\n%s\n", p->id,p->age,p->wages,p->name,p->passwd); } p = p->next ; } return 0 ; } #endif #if 1 int tea_write() { PTEA p; // PTEA head ; FILE *fp; p=head; fp=fopen("teacher.txt","w+"); while(p) { fprintf( fp, "%d\t%d\t%d\t%s\t%s\n", p->id,p->age,p->wages,p->name,p->passwd); p=p->next; } return 0; } #endif #if 0 int main(int argc,char * argv[]) { if(argc<2){ printf("execult error"); return -1;} int ret; PTEA p; ret=tea_llopen(argv[1]); if(ret<0){ printf("list is end\n"); return -1;} // tea_llshow(head); // int id; /* p=tea_llcheck(); printf("%d\t%d\t%d\t%s\n", p->id,p->age,p->wages,p->name); */ //tea_llshow(); // tea_lladd(head) ; // tea_llshow(head) ; // tea_lldelete( head ) ; // tea_llshow(head) ; tea_llcheck(head) ; return 0; } #endif
2. stu_list.c
#include<stdio.h> #include<stdlib.h> #include<string.h> #include"student.h" PSTU head1 = NULL ; int sq_stu ; #if 1 FILE*fp; int stu_llopen(char* path)//打開文件 { fp=fopen(path,"r"); if(fp==NULL){ perror("open fail"); return -1;} #ifdef _DEBUG_ printf ("open susess\n") ; #endif PSTU p; int ret; while(p) { #ifdef _DEBUG_ perror("while -time\n"); #endif p=malloc(sizeof(STU)); if(p==NULL){ printf("申請(qǐng)空間不夠"); return -1;} ret=fscanf(fp,"%d%d%d%d%d%d%s%s", &p->id,&p->age,&p->math,&p->english, &p->chinese,&p->class,p->name,p->passwd); #ifdef _DEBUG_ printf("ret is ok\n") ; #endif if(ret<=0) { #ifdef _DEBUG_ printf ("list is end \n ") ; #endif break; } if(head1==NULL){ p->next=NULL; p->pre=NULL; head1=p;} else{ p->next=head1; p->pre=NULL; head1->pre=p; head1=p;} } return 0; } #endif int stu_llshow()//顯示 { // FILE *fp; if(head1==NULL) return -1; PSTU p=head1; printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t班級(jí)\t姓名\n"); while(p) { printf("%d\t%d\t%d\t%d\t%d\t%d\t%s\n", p->id,p->age,p->math,p->english,p->chinese, p->class,p->name); p=p->next; } // fflush(stdout) ; return 0; } int stu_llcheck()//查找 { printf("\n輸入查找學(xué)號(hào)\n"); int key; scanf("%d",&key); while(getchar()!='\n'); PSTU p; p=head1; if(head1==NULL) { printf ("打開鏈表失敗") ; return -1; } while(p) { if(p->id==key) { #ifdef _DEBUG_ printf ("while p ") ; #endif printf("%d\t%d\t%d\t%d\t%d\t%d\t%s\n", p->id,p->age,p->math,p->english,p->chinese, p->class,p->name); break ; } p=p->next; } if (p==NULL) { printf ("未找到該學(xué)生"); printf ("是否繼續(xù)查找y/n") ; char ch ; ch=getchar(); while(getchar()!='\n'); if((ch='y')||(ch=='Y')) stu_llcheck() ; else exit(1) ; } return 0; } int __stu_lladd(PSTU p)//被調(diào)用添加 { if(p==NULL) return -1; if(head1==NULL){ p->next=NULL; p->pre=NULL; head1->pre=p; head1=p;} else{ p->next=head1; p->pre=NULL; head1->pre=p; head1=p;} return 0; } int stu_lladd()//添加 { PSTU p; p=malloc(sizeof(STU)); if(p==NULL) return -1; printf("\n輸入添加學(xué)生信息\n\n"); printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t班級(jí)\t姓名\t密碼\n"); scanf("%d%d%d%d%d%d%s", &p->id,&p->age,&p->math,&p->english, &p->chinese,&p->class,p->name,p->passwd); __stu_lladd(p); /* fprintf( fp , "%d\t%d\t%d\t%d\t%d\t%d\t%s\n", p->id,p->age,p->math,p->english,p->chinese,p->class,p->name ); fclose (fp) ; fp = fopen ("student.txt","r" ) ; */ return 0; } #if 1 int __stu_lldelete(int id)//被調(diào)用的刪除 { PSTU p; PSTU q=NULL; p=head1; while(p) { if(p->id==id){ if(p==head1){ if(head1->next){ head1=head1->next; head1->pre=NULL;} else{ head1=NULL;} } else{ if(p->next){ p->pre->next=p->next; p->next->pre=p->pre;} else{ p->pre->next=NULL;} } break; } p=p->next; } if (p==NULL) { printf ("未找到該學(xué)生\n"); } free(p); /* fclose (fp) ; p=head1 ; fp = fopen("student.txt","w+"); while(p){ fprintf (fp , "%d\t%d\t%d\t%d\t%d\t%d\t%s\n", p->id,p->age,p->math,p->english,p->chinese,p->class, p->name); p=p->next ; } fclose (fp) ; fp = fopen ("student.txt","r" ) ; p=head1 ; stu_llopen("") ; */} int stu_lldelete()//刪除 { int id; PSTU p; printf("\n輸入刪除學(xué)號(hào)\n"); scanf("%d",&id); while(getchar()!='\n') ; return __stu_lldelete(id); } #endif #if 1 int stu_llchange()//修改 { PSTU p; printf("\n輸入修改學(xué)號(hào)"); int key; scanf("%d",&key); while(getchar() != '\n'); p=head1; while(p) { if(p->id==key){ printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t班級(jí)\t姓名\t密碼\n"); scanf("%d%d%d%d%d%d%s%s", &p->id,&p->age,&p->math,&p->english, &p->chinese,&p->class,p->name,p->passwd); break ; } p=p->next;} /* fprintf( fp , "%d\t%d\t%d\t%d\t%d\t%s\t%d\n", p->id,p->age,p->math,p->english,p->chinese,p->name,p->class ); printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t姓名\t班級(jí)"); */ p = head1 ; printf ("修改之后為\n"); printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t班級(jí)\t姓名\n"); while(p) { printf("%d\t%d\t%d\t%d\t%d\t%d\t%s\n", p->id,p->age,p->math,p->english,p->chinese, p->class,p->name); p=p->next; } return 0; } #endif #if 1 //排序 int stu_sort() { PSTU p ; // p->sum == (p->math + p->english + p->chinese) ; PSTU new_head1=NULL; PSTU q=NULL,max=head1,prev; printf ("按照總成績排序\n"); while(head1) { //1,找到最大分?jǐn)?shù)的節(jié)點(diǎn)地址 max = head1; prev=q=NULL; p=head1; while(p) { if( (p->math+p->english+p->chinese) > (max->math+max->english+max->chinese) ) { max = p; prev= q; } q = p; p=p->next; } if(prev){ prev->next = max->next; }else{ head1= head1->next; } //3,把該節(jié)點(diǎn)頭插到新鏈表頭指針 max->next = new_head1; new_head1 = max; } head1 = max; stu_llshow() ; return 0 ; } #endif #if 1 PSTU stu_check_id() //校驗(yàn)學(xué)生用戶名 { PSTU p; p = head1; int id; char ch; printf("請(qǐng)輸入您的學(xué)號(hào):"); scanf("%d",&id); while(getchar() != '\n'); while(p) { if(p->id==id){ return p; } p = p->next; } printf ("找到該用戶\n") ; if(p==NULL){ printf("找不到該用戶\n"); printf("是否重試?[y/n]\n"); ch = getchar () ; while(getchar()!='\0'); if ((ch=='y')||(ch=='Y')) stu_check_id(); else menu(); } } #endif #if 1 PSTU stu_check_passwd() //校驗(yàn)學(xué)生密碼 { PSTU p; p =stu_check_id(); char passwd[20]; char ch; printf("請(qǐng)輸入密碼:"); scanf("%s",passwd); while(getchar()!='\n') ; if(strcmp (p->passwd , passwd)==0) { sq_stu = p->id ; return p; }else{ printf("密碼不正確\n"); printf("是否重新輸入[y/n]\n"); ch = getchar () ; while(getchar()!='\n'); if((ch=='y')||(ch=='Y')) stu_check_passwd(); else menu(); } return NULL; } #endif #if 1 int stu_change_passwd() { PSTU p; p=stu_check_passwd(); // p->passwd=1234; char new_passwd[20]; char new[20]; char ch; printf("請(qǐng)輸入新密碼:"); scanf("%s",new_passwd); while(getchar() != '\n'); printf("請(qǐng)?jiān)俅屋斎胄旅艽a:"); scanf("%s",new); while(getchar()!='\n') ; if(strcmp(new_passwd,new)==0) { strcpy(p->passwd,new_passwd) ; printf("密碼修改成功!\n"); } else { printf("密碼輸入錯(cuò)誤\n"); printf("是否重試[y/n]\n"); ch=getchar(); while (getchar()!='\n') ; if((ch=='y')||(ch=='Y')) stu_change_passwd(); else student_menu(); } return 0; } #endif #if 1 int stu_lookme() { PSTU p; p = head1 ; #ifdef _DEBUG_ printf ("%d\n",sq_stu) ; #endif while (p) { if (p->id==sq_stu){ printf("學(xué)號(hào)\t年齡\t數(shù)學(xué)\t英語\t語文\t班級(jí)\t姓名\t密碼\n"); printf("%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s\n", p->id,p->age,p->math,p->english,p->chinese, p->class,p->name,p->passwd); } p = p->next ; } return 0 ; } #endif #if 1 int stu_write() { PSTU p; FILE *fp; // PSTU head1 ; p=head1; fp=fopen("student.txt","w"); while(p) { fprintf( fp, "%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s\n", p->id,p->age,p->math,p->english,p->chinese,p->class,p->name,p->passwd); p=p->next; } return 0; } #endif #if 1 void stu_check_class() { int class ; PSTU p ; int i=0 ; p = head1 ; printf ("請(qǐng)輸入您要查找的班級(jí):\n"); scanf ("%d",&class); while(getchar()!='\n') ; while (p){ if (p->class==class ) { printf("%d\t%d\t%d\t%d\t%d\t%d\t%s\n", p->id,p->age,p->math,p->english,p->chinese, p->class,p->name); i++ ; } p=p->next; } if((p==NULL)&&(i==0)) printf("未找到該班級(jí)\n"); } #endif #if 0 int main(int argc,char * argv[]) { /* if(argc<2){ printf("execult error"); return -1;} */ int ret; PSTU p; ret=stu_llopen("student.txt"); if(ret<0){ printf("創(chuàng)建失敗\n"); return -1;} printf ("debug-000\n") ; // int id; stu_llshow(); // stu_lldelete(); // stu_llcheck() ; // stu_llshow(); stu_check_class() ; // stu_llchange(); // sleep (1) ; // stu_llshow(); // stu_sort(); // stu_llshow(); return 0; } #endif
3. student.txt
1002 25 100 90 85 1 s1 000
1003 25 107 90 84 1 s1 000
1004 25 100 90 80 1 s1 000
1005 25 107 90 80 1 s1 000
1006 25 100 90 80 1 s1 000
1007 25 108 90 80 1 s1 000
1008 25 100 78 80 1 s1 000
1009 25 100 90 80 1 s1 000
1010 25 100 45 80 1 s1 000
1012 25 90 90 80 1 s1 000
4. teacher.txt
10002 75 4500 wang2 000
10003 75 4500 wang3 000
10004 75 4500 wang4 000
10005 75 4500 wang5 000
10006 75 4500 wang6 000
10007 75 4500 wang7 000
10008 75 4500 wang8 000
10009 75 4500 wang9 000
10010 75 4500 wang10 000
10011 75 4500 wang11 000
10012 75 4500 wang12 000
10013 75 4500 wang13 000
10014 75 4500 wang14 000
10015 75 4500 wang15 000
10016 75 4500 wang16 000
10017 75 4500 wang17 000
10018 75 4500 wang18 000
5. menu.c
#include"student.h" #include"teacher.h" #if 1 void admin_menu_1() { char u[20]=""; char u1[20]="admin"; char p[20]=""; char p1[20]="admin"; while (1) { printf("管理員用戶名\n"); scanf("%s",u); while(getchar()!= '\n'); printf("管理員密碼\n"); scanf("%s",p); while(getchar()!= '\n'); if (strcmp(u,u1)==0&&strcmp(p,p1)==0) admin_menu_2() ; else printf ("輸入用戶名或密碼不正確,是否重試y/n\n"); char ch ; ch=getchar() ; while(getchar()!= '\n'); if ((ch=='y')||(ch=='Y')) admin_menu_1() ; else menu() ; } } #endif #if 1 void admin_menu_2() { while(1) { system ("clear"); printf("\n\n\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 1.管理老師 *\n"); printf("\t\t\t\t* 2.管理學(xué)生 *\n"); printf("\t\t\t\t* 0.返回 *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t請(qǐng)輸入數(shù)字選擇\n"); char ch ; ch=getchar(); while(getchar()!= '\n'); switch(ch) { case '1': admin_menu_2_1() ; break ; case '2': admin_menu_2_2() ; break ; case '0': menu(); default: admin_menu_2() ; break; } } } #endif #if 1 void teacher_menu() { tea_check_passwd(); char ch; while(1) { printf("\n\n\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 1.查找學(xué)生信息 *\n"); printf("\t\t\t\t* 2.按總成績排名 *\n"); printf("\t\t\t\t* 3.修改老師密碼 *\n"); printf("\t\t\t\t* 4.查看我的信息 *\n"); printf("\t\t\t\t* 5.按照班級(jí)查找學(xué)生 *\n"); printf("\t\t\t\t* 0.返回 *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t請(qǐng)輸入數(shù)字選擇\n"); ch=getchar(); while(getchar()!='\n'); switch(ch) { case '1': //admin_tea_delete();break; stu_llshow(); stu_llcheck(); break; case '2': stu_sort() ; break ; case '3': printf ("修改老師密碼\n") ; tea_change_passwd() ; break ; case '4': printf("我的信息\n"); tea_lookme() ; break; case '5': printf("按照班級(jí)查找\n"); stu_check_class(); break ; case '0': menu(); default : printf("字符不符\n"); break; } } } #endif #if 1 void student_menu() { stu_check_passwd(); while(1) { printf("\n\n\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 1.查詢我的信息 *\n"); printf("\t\t\t\t* 2.修改學(xué)生密碼 *\n"); printf("\t\t\t\t* 0.返回 *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t請(qǐng)輸入數(shù)字選擇\n"); char ch; ch=getchar(); while(getchar()!='\n'); switch(ch) { case '1': printf("查詢我的信息\n"); stu_lookme(); break; case '2': printf("修改密碼\n"); stu_change_passwd(); break; case '0': menu() ;// break;//exit(0); default : printf("請(qǐng)輸入\n"); break; } } } #endif #if 1 void menu() { char ch; while(1) { system ("clear"); printf("\n\n\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 歡迎進(jìn)入學(xué)生管理系統(tǒng) *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 1.管理員登錄 *\n"); printf("\t\t\t\t* 2.老師登錄 *\n"); printf("\t\t\t\t* 3.學(xué)生登錄 *\n"); printf("\t\t\t\t* 0.保存并退出 *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t請(qǐng)輸入數(shù)字選擇\n"); ch=getchar(); while(getchar()!= '\n'); switch(ch) { case '1': admin_menu_1();break; case '2': teacher_menu(); break; case '3': student_menu();break; case '0': tea_write() ; stu_write() ; exit(0) ; //break;//exit(0); default : printf("輸入不存在的字符\n"); break; } } } #endif #if 1 void admin_menu_2_1() { while(1) { printf("\n\n\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 1.刪除老師 *\n"); printf("\t\t\t\t* 2.添加老師 *\n"); printf("\t\t\t\t* 3.查找老師 *\n"); printf("\t\t\t\t* 4.修改老師 *\n"); printf("\t\t\t\t* 5.查看全部老師 *\n"); printf("\t\t\t\t* 0.返回 *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t請(qǐng)輸入數(shù)字選擇\n"); char ch ; ch=getchar(); while(getchar()!='\n'); switch(ch) { case '1': //admin_tea_delete();break; printf("刪除教師\n"); tea_llshow( ) ; tea_lldelete() ; break; case '2': printf("添加教師\n"); tea_lladd( ) ; tea_llshow() ; break; //admin_tea_add();break; case '3': printf("查找教師\n"); tea_llcheck( ) ; break; //admin_tea_cheak();break; case '4': printf("修改老師\n"); tea_llchange() ; break; case '5': printf("查看全部老師\n"); tea_llshow() ; break; // case '0': admin_menu_2() ;// break;//exit(0); default : printf("字符不符\n"); break; } } } #endif #if 1 void admin_menu_2_2() { while(1) { printf("\n\n\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t* 1.刪除學(xué)生 *\n"); printf("\t\t\t\t* 2.添加學(xué)生 *\n"); printf("\t\t\t\t* 3.查找學(xué)生 *\n"); printf("\t\t\t\t* 4.修改學(xué)生 *\n"); printf("\t\t\t\t* 5.查看全部學(xué)生 *\n"); printf("\t\t\t\t* 0.返回 *\n"); printf("\t\t\t\t******************************\n"); printf("\t\t\t\t請(qǐng)輸入數(shù)字選擇\n"); char ch ; ch=getchar(); while(getchar()!='\n'); switch(ch) { case '1': printf ("刪除學(xué)生"); stu_llshow(); stu_lldelete(); stu_llshow(); break ; case '2': printf("添加學(xué)生\n"); stu_lladd(); stu_llshow(); break ; case '3': printf("查找學(xué)生\n"); stu_llcheck(); break; case '4': printf("修改學(xué)生\n"); stu_llchange(); break; case '5': printf("查看全部學(xué)生\n"); stu_llshow() ; break; case '0': admin_menu_2() ; default : printf("請(qǐng)選擇\n"); break; } } } #endif #if 1 int main() { stu_llopen(FILENAME1); tea_llopen(FILENAME); #ifdef _DEBUG_ stu_llshow(); tea_llshow(); #endif sleep(1); system ("clear"); menu(); } #endif
推薦幾篇文章:
C++實(shí)現(xiàn)簡單的圖書管理系統(tǒng)
C++實(shí)現(xiàn)簡單的職工信息管理系統(tǒng)
關(guān)于管理系統(tǒng)的更多內(nèi)容請(qǐng)點(diǎn)擊《管理系統(tǒng)專題》進(jìn)行學(xué)習(xí)
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
如何用c++表驅(qū)動(dòng)替換if/else和switch/case語句
本文將介紹使用表驅(qū)動(dòng)法,替換復(fù)雜的if/else和switch/case語句,想了解詳細(xì)內(nèi)容,請(qǐng)看下文2021-08-08C語言詳盡圖解函數(shù)棧幀的創(chuàng)建和銷毀實(shí)現(xiàn)
我們知道c語言中函數(shù)都是被調(diào)用的,main函數(shù)里面能調(diào)用其他函數(shù),其實(shí)main函數(shù)也是被別的函數(shù)調(diào)用的,下面通過本文給大家分享c語言函數(shù)棧幀的創(chuàng)建和銷毀過程,一起看看吧2022-05-05