#include #include #include #include #define N 100struct employee{int num;char name[10];char zhicheng; int jiben;int jiangjin;int baoxian;int zafei;int shiji;}em[100]; /*定义一个结构体*/void menu();void input();void save(int);void display();void del();void search();void search_zhicheng();void search_name();void modify(); /*定义各函数*/void menu() /*菜单函数*/{ printf("\n"); printf(" 网计091 第7小组\n"); printf("\n"); printf(" ******************职工信息管理****************\n"); printf(" 1.录入职工信息"); printf(" 2.浏览职工信息\n"); printf(" 3.查询职工信息"); printf(" 4.删除职工信息\n"); printf(" 5.修改职工信息\n"); printf(" 6.退出\n"); printf(" ********************谢谢使用******************\n"); printf("\n"); printf("\n"); }void main(){ int n,flag; char a;while(1){ do { menu(); /*调用菜单函数*/ printf("请选择你需要操作的步骤(1--6):\n"); scanf("%d",&n); if(n>=1&&n<=6) { flag=1; break; } else { flag=0; printf("您输入有误,请重新选择!"); }}while(flag==0); switch(n) { case 1:printf(" 输入职工信息\n");printf("\n");input();break; case 2:printf(" 浏览职工信息\n");printf("\n");system("cls");display();break; case 3:printf(" 按职工号查询职工信息\n");printf("\n");system("cls");search();break; case 4:printf(" 删除职工信息\n");printf("\n");system("cls");del();break; case 5:printf(" 修改职工信息\n");printf("\n");system("cls");modify();break; case 6:goto la; default :break; } }la: system("cls"); printf("\n\n\n\n\n 谢谢使用!\n");}void input() /*录入函数*/{ int i,m; printf("请输入需要创建信息的职工人数(1--100):\n"); scanf("%d",&m); for (i=0;i=1&&t<=3) { flag=1; break; } else { flag=0; printf("您输入有误,请重新选择!"); }}while(flag==0);system("cls"); while(flag==1){ switch(t) { case 1:printf("按姓名查询\n");search_name();break; case 2:printf("按职称查询\n");search_zhicheng();break; case 3:main();break; default:break; } system("cls"); }}void search_name(){ char name1[10]; int i,t; int m=load(); printf("请输入要查找的姓名:\n"); scanf("%s",name1); for(i=0;i8||c<1) printf("\n选择错误,请重新选择!\n"); } flag=0; } } if(flag==1) printf("\n对不起,查无此人!\n"); do { switch(c) /*因为当找到第i个职工时,for语句后i自加了1,所以下面的应该把改后的信息赋值给第i-1个人*/ { case 1:printf("职工号改为: "); scanf("%d",&num); em[i-1].num=num; break; case 2:printf("姓名改为: "); scanf("%s",name); strcpy(em[i-1].name,name); break; case 3:printf("职称改为: "); getchar(); scanf("%c",&zhicheng); em[i-1].zhicheng=zhicheng; break; case 4:printf("基本工资改为: "); scanf("%d",&jiben); em[i-1].jiben=jiben; break; case 5:printf("奖金改为: "); scanf("%d",&jiangjin); //这里要用地址 em[i-1].jiangjin=jiangjin; break; case 6:printf("保险改为: "); scanf("%d",&baoxian);//这里要用地址 break; case 7:printf("杂费改为: "); scanf("%d",&zafei);//这里要用地址 em[i-1].zafei=zafei; break; case 8:printf("实际工资改为: "); scanf("%d",&shiji); em[i-1].shiji=shiji; break; } printf("\n"); printf("\n是否确定所修改的信息?\n 是 请按1 ; 不,重新修改 请按2: \n"); scanf("%d",&b); } while(b==2); printf("\n浏览修改后的所有职工信息:\n"); printf("\n"); save(m); display(); printf("\n继续修改请按1,不再修改请按0\n"); scanf("%d",&t); switch(t){ case 1:modify();break; case 0:break; default :break;}system("cls"); }