2022年C语言学生信息管理 .pdf
《2022年C语言学生信息管理 .pdf》由会员分享,可在线阅读,更多相关《2022年C语言学生信息管理 .pdf(16页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、#define PRINT0 printf(name:%snsex:%snage:%dnID_card:%dnaddress:%sn,sti.name,sti.sex,sti.age,sti.ID_card,sti.addr) #define PRINT1 printf(prefession:%snstudent_number:%dn*score*nwuli:%dn,sti.prefession,sti.student_number,sti.score.wuli) #define PRINT2 printf(gaoshu:%dnyingyu:%dntiyu:%dnaverage: %dn,st
2、i.score.gaoshu,sti.score.yingyu,sti.score.tiyu,sti.score.aver) #define print1 printf(_) #define N 2 #include string.h #include stdio.h int sum=0; struct score int wuli; int gaoshu; int yingyu; int tiyu; int aver; ; struct message char name10; int age; char sex5; int ID_card; char addr30; char prefes
3、sion30; int student_number; struct score score; st100; /*write message*/ write_message() int flag; char chioce; dosystem(cls); flag=2; sum+; printf(_); printf(please input students message:n); printf(n);print1; printf(%dth student message:,sum); print1; printf(nname:); 名师资料总结 - - -精品资料欢迎下载 - - - - -
4、 - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 16 页 - - - - - - - - - scanf(%s,stsum.name); printf(nsex:); scanf(%s,stsum.sex); printf(nage:); scanf(%d,&stsum.age); printf(nID_card:); scanf(%d,&stsum.ID_card); printf(naddress:); scanf(%s,stsum.addr); printf(nprefession:); scanf(%s,stsum.pre
5、fession); printf(nschool number:); scanf(%d,&stsum.student_number); printf(n*score*n); printf(wuli:); scanf(%d,&stsum.score.wuli); printf(ngaoshu:); scanf(%d,&stsum.score.gaoshu); printf(nyingyu:); scanf(%d,&stsum.score.yingyu); printf(ntiyu:); scanf(%d,&stsum.score.tiyu); printf(naverage:); scanf(%
6、d,&stsum.score.aver); do printf(*n); printf(press y/Y continue:npress n/N stop:n); getchar(); scanf(%c,&chioce); printf(*n); if(chioce=y|chioce=Y) flag=1; break; else if(chioce=n|chioce=N) flag=0; break; else printf(input errorn); print1;printf(n); while(1); while(flag=1); save_message(); /*save mes
7、sage*/ save_message() FILE *fp;int i; if(fp=fopen(student.txt,wb)=NULL) printf(read error n); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 16 页 - - - - - - - - - printf(press any key back to menun); getch();exit(1); for(i=0;isum;i+) if(fwrite(&sti,sizeof(stru
8、ct message),1,fp)!=1) printf(write errorn);fclose(fp); fclose(fp); printf(n*_OK!_*n_press any key back_); sum=i; bioskey(0); /*add message*/ add_message() int i,j,flag; char chioce; i=0;j=sum-1;flag=0; do system(cls); i+; j+; print1; printf(add %dth students meaasgen,i); print1; printf(nname:); scan
9、f(%s,stj.name); printf(nsex:); scanf(%s,stj.sex); printf(nage:); scanf(%d,&stj.age); printf(nID_card:); scanf(%d,&stj.ID_card); printf(naddress:); scanf(%s,stj.addr); printf(nprefession:); scanf(%s,stj.prefession); printf(nstudent_number:); scanf(%d,&stj.student_number); printf(n*score*n); printf(wu
10、li:); scanf(%d,&stj.score.wuli); printf(ngaoshu:); scanf(%d,&stj.score.gaoshu); printf(nyingyu:); scanf(%d,&stj.score.yingyu); printf(ntiyu:); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 16 页 - - - - - - - - - scanf(%d,&stj.score.tiyu); printf(naverage:); sc
11、anf(%d,&stj.score.aver); printf(nnweather add %dth students message: n,i+1); do printf(*n); printf(press y/Y continue:npress n/N stop:n); getchar(); scanf(%c,&chioce); printf(*n); if(chioce=y|chioce=Y) flag=1; break; else if(chioce=n|chioce=N) flag=0; break; else printf(input errorn); print1; while(
12、1); while(flag=1); sum=j+1; save_message(); /*inqiure message*/ inqiure_message() int chioce; dosystem(cls); printf(*choose 0-3*nnn); printf( 1:name inquirennn); printf( 2:IDcard inqiurennn); printf( 3:student_numbern nn); printf( 0:back menunnn); scanf(%d,&chioce); switch(chioce) case 1: name_inqiu
13、re();break; case 2: ID_card_inqiure();break; case 3: grade_inqiure();break; case 0:break; while(chioce!=0); /*name inqiure*/ name_inqiure() char NAME30; int i; int flag,k; char chioce; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 16 页 - - - - - - - - - do sys
14、tem(cls);k=0; printf(please input the message you inqiure); printf(nname:); scanf(%s,NAME); getchar(); printf(n); for(i=0;isum;i+) if(strcmp(sti.name,NAME)=0) PRINT0; PRINT1; PRINT2;k=1; if(k=0) printf(without message you inqiuren); do printf(*n); printf(press y/Y continue:npress n/N stop:n); scanf(
15、%c,&chioce); getchar(); printf(*n); if(chioce=y|chioce=Y) flag=1; break; if(chioce=n|chioce=N) flag=0; break; else printf(input errorn); print1;printf(n); while(1); while(flag=1); printf(press any key return to menu); bioskey(0); /*IDcard inqiure*/ ID_card_inqiure() int card; int i; int flag,k; char
16、 chioce; do clrscr(); k=0; printf(please input the message you inqiure); printf(nIDcard:); scanf(%d,&card); getchar(); printf(n); for(i=0;isum;i+) if(sti.ID_card=card) PRINT0; PRINT1; PRINT2;k=1; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 16 页 - - - - - - -
17、 - - if(k=0) printf(without message you inqiuren); do printf(*n); printf(press y/Y continue:npress n/N stop:n); scanf(%c,&chioce); getchar(); printf(*n); if(chioce=y|chioce=Y) flag=1; break; if(chioce=n|chioce=N) flag=0; break; else printf(input errorn); print1;printf(n); while(1); while(flag=1); pr
18、intf(press any key return to menu); bioskey(0); /*grade inqiure*/ grade_inqiure() int GRADE; int i; int flag,k; char chioce; do system(cls);k=0; printf(please input the message you inqiure); printf(nstudent_number:); scanf(%d,&GRADE); getchar(); printf(n); for(i=0;isum;i+) if(sti.student_number=GRAD
19、E) PRINT0; PRINT1; PRINT2;k=1; if(k=0) printf(without message you inqiuren); do printf(*n); printf(press y/Y continue:npress n/N stop:n); scanf(%c,&chioce); getchar(); printf(*n); if(chioce=y|chioce=Y) flag=1; break; if(chioce=n|chioce=N) flag=0; break; else printf(input errorn); print1;printf(n); w
20、hile(1); while(flag=1); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 16 页 - - - - - - - - - printf(press any key return to menu); bioskey(0); /*change message*/ change_message() char pre30,chioce; int i,gra,flag,num,s;s=0; dosystem(cls); printf(please input m
21、essage you want to changen ); printf(student_number:);scanf(%d,&gra); getchar(); for(i=0;isum;i+) if(sti.student_number=gra) PRINT0; PRINT1; PRINT2; printf(n*input message you want to change*n); printf(0:name*1:sex*2:age*3:ID_card*4:address*n5:prefession*6:wuli*7:student_number*8n:gaoshu*9:yingyu*10
22、:tiyu*11:average*_n); printf(choose 0-11n); scanf(%d,&num); getchar(); switch(num) case 0: printf(input the name changedn); scanf(%s,sti.name); getchar(); break; case 1: printf(input the sex changedn); scanf(%s,sti.sex); getchar(); break; case 2: printf(input the age changedn); scanf(%d,&sti.age); g
23、etchar(); break; case 3: printf(input the ID_card changedn); scanf(%d,&sti.ID_card); getchar(); break; case 4: printf(input the address changedn); scanf(%s,sti.addr); getchar(); break; case 5: printf(input the prefession changedn); scanf(%s,sti.prefession); getchar(); break; case 6: printf(input the
24、 wuli_score changedn); scanf(%d,&sti.score.wuli); getchar(); break; case7: printf(input the student_number changedn); scanf(%d,&sti.student_number); getchar(); break; case 8: printf(input the gaoshu_score changedn); scanf(%d,&sti.score.gaoshu); getchar(); break; case 9: printf(input the yingyu_score
25、 changedn); scanf(%d,&sti.score.yingyu); getchar(); break; case 10: printf(input the tiyu_score changedn); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 16 页 - - - - - - - - - scanf(%d,&sti.score.tiyu); getchar(); break; case 11: printf(input the average_score
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年C语言学生信息管理 2022 语言 学生 信息管理
限制150内