commit a7dfc9c681c33c3c37fe5b4d12455f49ed134d62 Author: 2228628942@qq.com <2228628942@qq.com> Date: Wed Jan 9 22:18:06 2019 +0800 first commit diff --git a/学生学籍管理系统4.cpp b/学生学籍管理系统4.cpp new file mode 100644 index 0000000..439e513 --- /dev/null +++ b/学生学籍管理系统4.cpp @@ -0,0 +1,471 @@ +# include +#include +#include +#include +#define N 100 +struct student +{ + char no[9]; + char name[25]; + char sex[10]; + int age; + char jiguan[25]; + char xibie[25]; + char zhuanye[25]; + int ban; + }stu[N]; + void menu() + { + + int choice,w1; + void add();void find();void shanchu();void change();void tongji(); + void read();void input(); + do + { + puts("\t******************************"); + puts("\t* ӭʹѧϵͳ *"); + puts("\t* 1 ¼ѧ *"); + puts("\t* 2ѧ *"); + puts("\t* 3ɾѧ *"); + puts("\t* 4޸ѧ *"); + puts("\t* 5ѧŻרҵѧ*"); + puts("\t* 6鿴ѧ *"); + puts("\t 7˳ϵͳ *"); + puts("\t***********************************"); + printf("ѡĹ:"); + scanf("%d",&choice); + if(choice<1||choice>8) + { + w1=1;printf("˵ѡѡ\n");} + else + w1=0; + }while(w1==1); + switch(choice) + { + case 1: + add(); + break; + case 2: + find(); + break; + case 3: + shanchu(); + break; + case 4: + change(); + break; + case 5: + tongji(); + break; + case 6: + read(); + break; + case 7: + break; + default: + exit(0); + } + } + int load() + { + FILE *fp; + int i; + if((fp=fopen("result.txt","a+"))==NULL) + { + printf("ļ򿪴"); + exit(0); + } + for(i=0;feof(fp);i++) + fread(&stu[i],sizeof(struct student),1,fp); + fclose(fp); + return(i-1); + } + //********溯 + void save(int n) + { + int i; + FILE*fp; + if((fp=fopen("results.txt","a+"))=NULL) + { + printf("ļ򿪴"); + } + for(i=0;i2) + {xz=1;system("cls");printf("ѡ\n"); + } + else xz=0; + }while(xz==1); + switch(choice) + { + case 1: + menu(); + break; + case 2: + exit(0); + break; + } + } +} +//*********¼ѧϢ +void add() +{ + FILE *fp; + int i,m,n; + n=0; + if((fp=fopen("results.txt","wb"))=NULL) + { + printf("ļ򿪴\n"); + exit(1); + } + printf("¼ٸѧϢ"); + scanf("%d",&m); + for(i=0;i2) + {xz=1;system("cls"); + printf("ѡ\n");} + else xz=0; + }while(xz==1); + switch(choice) + { + case 1: + menu();break; + case 2: + exit(0);break; + } + } + } + //****Һ******// + void find() + { + int menu(); + int i,n; + char m[9]; + n=load(); + printf("\t\t\t ӭʹѧŲҹ\nҪҵѧѧţ"); + scanf("%s",&m); + if(!strcmp(stu[i].no,m)) + { + printf("ѧ\tԱ\t\t\tϵͳ\tרҵ\t༶\n"); + printf("%s",stu[i].no); + printf("\t%s",stu[i].name); + printf("\t%s",stu[i].sex); + printf("\t%d",stu[i].age); + printf("\t%s",stu[i].jiguan); + printf("\t%s",stu[i].xibie); + printf("\t%s",stu[i].zhuanye); + printf("\t%d\n",stu[i].ban); + } + + else + printf("ѧŴ"); + { + int xz,choice; + do + { + printf("\n 1-˵ 2-˳ϵͳ\n"); + scanf("%d",&choice); + if(choice<1||choice>2) + {xz=1;system("cls");printf("ѡ\n");} + else xz=0; + }while(xz==1); + switch(choice) + { + case 1: + menu();break; + case 2: + exit(0);break; + + } + } + } + //޸ĺ + void change() + { + int n,i,j; + + char m[9]; + n=load(); + printf("ӭʹ޸Ĺ\nҪ޸ѧѧ"); + scanf("%s",&m); + if(!strcmp(stu[i].no,m)) + { + printf("Ҫ޸ĵĿ\n1ѧ 2 3Ա 4 5 6ϵ 7רҵ 8༶\n"); + printf("ѡĹǣ"); + scanf("%d",&j); + switch(j) + { + case 1: + printf("޸ĺѧţ"); + scanf("%s,stu[i].name"); + break; + case 2: + printf("޸ĺ"); + scanf("%s",stu[i].name); + break; + case 3: + printf("޸ĺԱ"); + scanf("%s,stu[i].sex"); + break; + case 4: + printf("޸ĺ䣻"); + scanf("%d",&stu[i].age); + break; + case 5: + printf("޸ĺļ᣻"); + scanf("%s",stu[i].jiguan); + break; + case 6: + printf("޸ĺϵ"); + scanf("%s",stu[i].xibie); + break; + case 7: + printf("޸ĺרҵ"); + scanf("%s",stu[i].zhuanye); + break; + case 8: + printf("޸ĺİ༶"); + scanf("%d",&stu[i].ban); + break; + default: + printf("ѡܴ\n"); + break; + } + } + save(1); + { + int xz,choice; + do + { + printf("\n 1-˵ 2-˳ϵͳ\n"); + scanf("%d",&choice); + if(choice<1||choice>2) + {xz=1;system("cls");printf("ѡ\n"); + } + else xz =0; + }while(xz==1); + switch(choice) + { + case 1: + menu(); + break; + case 2: + exit(0); + break; + } + + } + } + + //**********ͳƺ + void tongji_1()//ѧͳ + { + int n,i,sum=0; + char m[9]; + n=load(); + printf("ҪͳƵѧţ"); + scanf("%s",&m); + printf("ѧ\t\tԱ\t\t\tϵ\tרҵ\t༶\n"); + for(i=0;!strcmp(m,stu[i].zhuanye);i++) + { + printf("%s",stu[i].no); + printf("\t%s",stu[i].name); + printf("\t%s",stu[i].sex); + printf("\t%d",stu[i].age); + printf("\t%s",stu[i].jiguan); + printf("\t%s",stu[i].xibie); + printf("\t%s",stu[i].zhuanye); + printf("\t%d\n",stu[i].ban); + sum++; + printf("%sѧŵѧ%d\n",m,sum);} + } + void tongji_2()//רҵͳ + { + int n,i,sum=0; + char m[25]; + n=load(); + printf("ҪͳƵרҵ"); + scanf("%s",&m); + printf("ѧ\t\tԱ\t\t\tרҵ\t༶\n"); + for(i=0;!strcmp(m,stu[i].zhuanye);i++) + { + printf("%s",stu[i].no); + printf("\t%s",stu[i].name); + printf("\t%s",stu[i].sex); + printf("\t%d",stu[i].age); + printf("\t%s",stu[i].jiguan); + printf("\t%s",stu[i].xibie); + printf("\t%s",stu[i].zhuanye); + printf("\t%d\n",stu[i].ban); + sum++; + printf("%sרҵѧ%d\n",m,sum);} + } + void tongji() + { + int n,m; + n=load(); + printf("ӭʹͳƹ\nͳƵĿǣ1) ѧ\t 2)רҵ\n"); + printf("ѡĹܣ"); + scanf("%d",&m); + switch(m) + { + case 1: + tongji_1(); + break; + case 2: + tongji_2(); + break; + default: + printf("ѡĹܴ\n"); + int getch(); + tongji(); + break; + } + { + int xz,choice; + do + { + printf("\n 1-˵ 2-˳ϵͳ\n"); + scanf("%d",&choice); + if(choice<1||choice>2) + {xz=1,system("cls");printf("ѡ\n"); + } + else xz =0; + }while(xz==1); + switch(choice) + { + case 1: + menu(); + break; + case 2: + exit(0); + break; + } + } + } +//**************ɾ +void shanchu() +{ +int n,j,i,k; +char m[9]; +n=load(); +printf("ҪɾٸϢ"); +scanf("%d",&k); +printf("Ҫɾѧѧ"); +scanf("%s",&m); +for(i=0;i2) + {xz=1,system("cls");printf("ѡ\n"); + } + else xz =0; + }while(xz==1); + switch(choice) + { + case 1: + menu(); + break; + case 2: + exit(0); + break; + } + } + } + int main() + { + menu(); + } + + + + + + + + + + + + + + + + + + + diff --git a/学生学籍管理系统4.exe b/学生学籍管理系统4.exe new file mode 100644 index 0000000..2a731d3 Binary files /dev/null and b/学生学籍管理系统4.exe differ