C 语言课程设计 1 . 设计题目:职工信息管理系统 2 . 系统功能简介: 系统以菜单方式工作 1 )职工信息录入(文件保存职工信息) 2 )输出职工信息、浏览职工信息 3 )查询职工信息 4 )根据员工号查找职工信息 5 )根据工资、年龄、性别对职工信息进行排序 6 )删除职工信息 3 . 设计实施: #include #include #include typedef struct Empk { int EmpNum; /* staff number */ char EmpName[12]; /* name*/ int Sex; /*sex 1- woman 2- man*/ int Old; /* old*/ int Cult; /*education background 1-specilist 2-doctor 3-others*/ int Salary; /*salary*/ char Address[12]; /* address*/ int Tell; /*telephone number*/ }Emp; Emp emp[100]; void open() { int i; FILE *fp; if((fp=fopen("wyl","rb+"))==NULL) {printf("can not do it! Because of no file of information\n"); exit(0);} for(i=0;i<100;i++) {if(fread(&emp[i],sizeof(Emp),1,fp)==0) {printf("Fail to output\n"); exit(0);} } fclose(fp); } void close() /*跳出*/ { int i; FILE *fp; if((fp=fopen("wyl","wr+"))==NULL) {printf("can not do it!\n"); exit(0);} for(i=0;i<100;i++) fwrite(&emp[i],sizeof(Emp),1,fp); fclose(fp); } void inputEmpInfo() /*输入信息*/ { int i,k; for(i=0;i<100;i++) { printf("Please enter the staff's :\nnumber:"); scanf("%d",&emp[i].EmpNum); printf("\nname:"); scanf("%s",emp[i].EmpName); printf("\nsex : 1- woman 2- man:"); scanf("%d",&emp[i].Sex); printf("\nold:"); scanf("%d",&emp[i].Old); printf("\nEducation background:1-specialist 2-doctor 3-others"); scanf("%d",&emp[i].Cult); printf("\nsalary:"); scanf("%d",&emp[i].Salary); printf("\naddress:"); scanf("%s",emp[i].Address); printf("\ntellphone:"); scanf("%d",&emp[i].Tell); printf("continue?(1.yes 2.no)"); scanf("%d",&k); if(k==2) break; } close(); } void reorder() /*修改*/ { int i,s,j,k,l; Emp temp; open(); printf("\nChoose which category would you want to use\n1---sex \n2---salary(from...