|
|
#include <stdio.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <windows.h>
|
|
|
int i=1;
|
|
|
struct staffsinfor
|
|
|
{
|
|
|
char staffnums[100];
|
|
|
char name[100];
|
|
|
char sex[100];
|
|
|
char studyF[100];
|
|
|
char homedress[100];
|
|
|
char money[100];
|
|
|
char phonenum[100];
|
|
|
};
|
|
|
void input(struct staffsinfor staffs[]){
|
|
|
int j;
|
|
|
two :system("cls");
|
|
|
printf("\t\t\t\t您在进行的是信息录入!\t\t\t已有人数%d(最多50人)\n\n\n",i);
|
|
|
if(i==50)
|
|
|
{
|
|
|
MessageBox(NULL,"人数已满!","系统提示",MB_OK);
|
|
|
return 0;
|
|
|
}
|
|
|
printf("\t\t\t请输入姓名\n");
|
|
|
gets(staffs[i].name);
|
|
|
printf("\t\t\t请输入职工号\n");
|
|
|
gets(staffs[i].staffnums);
|
|
|
printf("\t\t\t请输入性别\n");
|
|
|
gets(staffs[i].sex);
|
|
|
printf("\t\t\t请输入学历\n");
|
|
|
gets(staffs[i].studyF);
|
|
|
printf("\t\t\t亲输入工资\n");
|
|
|
gets(staffs[i].money);
|
|
|
printf("\t\t\t请输入住址\n");
|
|
|
gets(staffs[i].homedress);
|
|
|
printf("\t\t\t请输入电话\n");
|
|
|
gets(staffs[i].phonenum);
|
|
|
j=MessageBox(NULL,"是否确定?","系统提示",MB_YESNO);
|
|
|
if(j==6)
|
|
|
{
|
|
|
MessageBox(NULL,"录入成功","系统提示",MB_OK);
|
|
|
i++;
|
|
|
j=MessageBox(NULL,"是否继续录入?","系统提示",MB_YESNO);
|
|
|
if(j==6)
|
|
|
goto two;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MessageBox(NULL,"请重新录入","系统提示",MB_OK);
|
|
|
goto two;
|
|
|
}
|
|
|
}
|
|
|
void look(struct staffsinfor staffs[]){
|
|
|
int j=i;j--;char o;
|
|
|
three :
|
|
|
system("cls");
|
|
|
printf("\t\t\t\t您在进行的是浏览名单!\n\n\n");
|
|
|
if(j==0)
|
|
|
{
|
|
|
MessageBox(NULL,"未找到名单信息!","系统提示",MB_OK);
|
|
|
return 0;
|
|
|
}
|
|
|
printf("\t\t\t姓名:\n\t\t\t\t\t\t\t%s",staffs[j].name);
|
|
|
printf("\n\t\t\t职工号:\n\t\t\t\t\t\t\t%s",staffs[j].staffnums);
|
|
|
printf("\n\t\t\t性别:\n\t\t\t\t\t\t\t%s",staffs[j].sex);
|
|
|
printf("\n\t\t\t学历:\n\t\t\t\t\t\t\t%s",staffs[j].studyF);
|
|
|
printf("\n\t\t\t工资:\n\t\t\t\t\t\t\t%s",staffs[j].money);
|
|
|
printf("\n\t\t\t家庭住址:\n\t\t\t\t\t\t\t%s",staffs[j].homedress);
|
|
|
printf("\n\t\t\t电话号码:\n\t\t\t\t\t\t\t%s",staffs[j].phonenum);
|
|
|
printf("\n\n\n\t\t\t\t\t\t按A和D切换名单\n\t\t\t\t\t\t按BackSpace退回菜单");
|
|
|
o=getch();
|
|
|
if(o=='A')
|
|
|
{
|
|
|
if(j==1)
|
|
|
{system("cls");
|
|
|
printf("这已经是第一个了");
|
|
|
system("pause");
|
|
|
goto three;
|
|
|
}
|
|
|
j--;
|
|
|
goto three;
|
|
|
}
|
|
|
if(o=='D')
|
|
|
{
|
|
|
if(j==i&&j!=i)
|
|
|
{system("cls");
|
|
|
printf("这是最后一个了");
|
|
|
system("pause");
|
|
|
goto three;
|
|
|
}
|
|
|
j++;
|
|
|
goto three;
|
|
|
}
|
|
|
if(o==8)
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
}
|
|
|
void cha(struct staffsinfor staffs[]){
|
|
|
char a;char name[100];int o;
|
|
|
system("cls");
|
|
|
printf("\t\t\t\t管理菜单\t\t\t\t\n");
|
|
|
printf("**********************************************************************\n\n\n");
|
|
|
printf("\t\t\t\tA.按职工好查询\t\t\t\t\n\n");
|
|
|
printf("\t\t\t\tB.按姓名查询\t\t\t\t\n\n");
|
|
|
printf("\t\t\t\t\t\t\t\t\n\n");
|
|
|
printf("\t\t\t\t\t按BackSpace返回上一页\n\n\n\n\n");
|
|
|
printf("**********************************************************************\n");
|
|
|
a=getch();
|
|
|
if(a=='A')
|
|
|
{
|
|
|
four :
|
|
|
system("cls");
|
|
|
printf("\t\t\t\t您在进行的是信息录入!\t\t\t\n\n\n");
|
|
|
printf("请输入职员职工号\n");
|
|
|
gets(name);
|
|
|
for(o=0;o<i;o++)
|
|
|
{
|
|
|
if(strcmp(name,staffs[o].name)==0)
|
|
|
{
|
|
|
printf("\t\t\t姓名:\n\t\t\t\t\t\t\t%s",staffs[o].name);
|
|
|
printf("\n\t\t\t职工号:\n\t\t\t\t\t\t\t%s",staffs[o].staffnums);
|
|
|
printf("\n\t\t\t性别:\n\t\t\t\t\t\t\t%s",staffs[o].sex);
|
|
|
printf("\n\t\t\t学历:\n\t\t\t\t\t\t\t%s",staffs[o].studyF);
|
|
|
printf("\n\t\t\t工资:\n\t\t\t\t\t\t\t%s",staffs[o].money);
|
|
|
printf("\n\t\t\t家庭住址:\n\t\t\t\t\t\t\t%s",staffs[o].homedress);
|
|
|
printf("\n\t\t\t电话号码:\n\t\t\t\t\t\t\t%s",staffs[o].phonenum);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
a=MessageBox(NULL,"是否修改信息","系统提示",MB_YESNO);
|
|
|
if(a==6)
|
|
|
{
|
|
|
printf("\n\t\t\t\t请选择要修改的信息");
|
|
|
printf("\t\1.姓名\t2.职工号\t3.性别\t4.工资\t5.家庭住址\t6.学历\t7.电话号码");
|
|
|
a=getch();
|
|
|
if(a==1)
|
|
|
printf("原姓名:%s\n",staffs[o].name);
|
|
|
printf("请输入新姓名:");
|
|
|
gets(staffs[o].name);
|
|
|
a=MessageBox(NULL,"确认更改?""系统提示",MB_YESNO);
|
|
|
if(a==6)
|
|
|
MessageBox(NULL,"","",MB_OK);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
int main()
|
|
|
{
|
|
|
char a;struct staffsinfor staffs[50];
|
|
|
/*职工信息管理系统设计(最多2人)
|
|
|
职工信息包括职工号、姓名、性别、年龄、学历、工资、住址、电话等(职工号不重复)。
|
|
|
试设计一职工信息管理系统,使之能提供以下功能:
|
|
|
1、系统以菜单方式工作
|
|
|
2、职工信息录入功能(职工信息用文件保存)--输入
|
|
|
3、职工信息浏览功能--输出
|
|
|
4、职工信息查询功能--算法
|
|
|
查询方式
|
|
|
按学历查询等
|
|
|
按职工号查询等
|
|
|
5、职工信息删除、修改功能(可选项)*/
|
|
|
|
|
|
one :
|
|
|
system("cls");
|
|
|
printf("\t\t\t\t管理菜单\t\t\t\t\n");
|
|
|
printf("**********************************************************************\n\n\n");
|
|
|
printf("\t\t\t\tA.录入信息\t\t\t\t\n\n");
|
|
|
printf("\t\t\t\tB.浏览名单\t\t\t\t\n\n");
|
|
|
printf("\t\t\t\tC.查询信息\t\t\t\t\n\n");
|
|
|
printf("\t\t\t\t\t按BackSpace返回上一页\n\n\n");
|
|
|
printf("\t\t\t\t\tBy--罗丁,高论域\n\n");
|
|
|
printf("**********************************************************************\n");
|
|
|
a=getch();
|
|
|
if(a=='A')
|
|
|
{
|
|
|
input(staffs);
|
|
|
goto one;
|
|
|
}
|
|
|
else if(a=='B')
|
|
|
{
|
|
|
look(staffs);
|
|
|
goto one;
|
|
|
}
|
|
|
else if(a=='C')
|
|
|
{
|
|
|
|
|
|
a=getch();
|
|
|
if(a==8)
|
|
|
goto one;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
printf("输入错误!");
|
|
|
system("pause");
|
|
|
goto one;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|