资源描述:
《职工信息管理系统设计1》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、#include/*标准I/O函数*/#include"conio.h"/*屏幕操作函数*/typedefstructxinxi{charNo[10];/*职工号*/charname[10];/*姓名*/charsex[10];/*性别*/charbir[20];/*出生年月*/charxueli[20];/*学历*/charzhiwu[20];/*职务*/chargongzi[10];/*工资*/chartel[15];/*电话号码*/charaddr[50];/*住址*/}XINXI;charfilename[20
2、];FILE*fp;voidshowTitle();/*显示标题行*/voidselectMenu();/*主菜单*/voidsortXinxiMenu();/*排序菜单*/voidinputFileName();/*输入职工信息文件名*/voidcreateXinxi();/*新建职工信息系统*/voiddisplayXinxi();/*显示职工信息*/voidsearchXinxi();/*按姓名查找记录*/voidappendXinxi();/*添加记录*/voidmodifyXinxi();/*根据姓名修改记录*/voiddel
3、eteXinxi();/*按姓名删除记录*/voidsaveXinxi(XINXI*,int);/*保存信息文件*/intloadXinxi(XINXI*);/*装载信息文件*/voidswap(XINXI*,XINXI*);/*交换记录*/voidsAscByXueli();/*按姓名升序排序*/voidsAscByTel();/*按电话号码升序排序*/main(){clrscr();inputFileName();selectMenu();}/*输入职工信息文件名*/voidinputFileName(){printf("Inp
4、utFileName(请输入职工信息文件名):");scanf("%s",filename);}/*新建职工信息文件*/voidcreateXinxi(){XINXIone;if((fp=fopen(filename,"wb"))==NULL){printf("不能建立信息文件!");exit();}clrscr();printf(fp,"%-10s%-10s%-10s%-20s%-20s%-20s%-10s%-15s%-50s","No(职工号)","Name(姓名)","Sex(性别)","Birthday(出生年月)","
5、Xueli(学历)","Zhiwu(职务)","Gongzi(工资)","Telephone(电话号码)","Address(住址)");printf("InputNo,Name,Sex,Birthday,Xueli,Zhiwu,Gongzi,Telephone,Address[请输入职工号,姓名,性别,出生年月,学历,职务,工资,电话号码及住址(以0结束)]:");scanf("%s",one.No);while(strcmp(one.No,"0")){scanf("%s%s%s%s%s%s%s%s",one.name,one
6、.sex,one.bir,one.xueli,one.zhiwu,one.gongzi,one.tel,one.addr);fprintf(fp,"-10s%-10s%-10s%-20s%-20s%-20s%-10s%-15s%-50s",one.name,one.sex,one.bir,one.xueli,one.zhiwu,one.gongzi,one.tel,one.addr);scanf("%s",one.No);}fclose(fp);}/*显示职工信息*/voiddisplayXinxi(){XINXIone;intco
7、unt=0;if((fp=fopen(filename,"rb"))==NULL){printf("不能打开职工信息文件!");exit();}showTitle();/*显示表头*/while(!feof(fp)){fscanf(fp,"%s%s%s%s%s%s%s%s",one.No,one.name,one.sex,one.bir,one.xueli,one.zhiwu,one.gongzi,one.tel,one.addr);printf("%-10s%-10s%-10s%-20s%-20s%-20s%-10s%-15s
8、%-50s",one.No,one.name,one.sex,one.bir,one.xueli,one.zhiwu,one.gongzi,one.tel,one.addr);count++;if(!(