You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

354 lines
12 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string.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\tA.单个浏览\t\tB.总览");
o=getch();
if(o=='A')
{
system("cls");
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;
}
if(o=='B')
{ system("cls");
printf("职工号 姓名 性别 学历 工资 电话号码 家庭住址\n");
int p;
for(p=1;p<i;p++)
{
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\n",staffs[p].staffnums,staffs[p].name,staffs[p].sex,staffs[p].studyF,staffs[p].phonenum,staffs[p].homedress);
system("pause");
}
}
}
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;
}
}
system("pause");
a=MessageBox(NULL,"是否修改信息","系统提示",MB_YESNO);
if(a==6)
{
six :
system("cls");
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("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
if(a==2)
{
printf("原姓名:%s\n",staffs[o].name);
printf("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
if(a==3)
{
printf("原姓名:%s\n",staffs[o].name);
printf("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
if(a==4)
{
printf("原姓名:%s\n",staffs[o].name);
printf("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
if(a==5)
{
printf("原姓名:%s\n",staffs[o].name);
printf("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
if(a==6)
{
printf("原姓名:%s\n",staffs[o].name);
printf("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
if(a==7)
{
printf("原姓名:%s\n",staffs[o].name);
printf("请输入新姓名:");
char ms[100];
gets(ms);
strcpy(staffs[o].name,ms);
int q; q=MessageBox(NULL,"确认更改?","系统提示",MB_YESNO);
if(q==6)
MessageBox(NULL,"修改成功","系统提示",MB_OK);
else
goto six;
}
}
else
goto four;
}
if(a=='B');
}
void shanchu(struct staffsinfor staffs[]){
seven :
system("cls");
int j;
printf("\t\t\t\t您在进行的是删除名单!\n\n\n");
printf("已有名单:");
//这里是全部人的数据,并要有序号。
printf("请选择要删除人的序号");
scanf("%d",&j);
int o;
for(o=0;o<i;o++)
{
if(o==j)
{
system("cls");
printf("以下是你选择的人的信息\n");
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);
int q;
q=MessageBox(NULL,"确认删除?","系统提示",MB_YESNO);
if(q==6)
{
int p;
for(p=j;p<i;p++)
{
/* staffs[p].name=staffs[p+1].name;
staffs[p].staffnums=staffs[p+1].staffnums;
//其余的也更过来。。。。
*/}
i--;
goto seven;
}
}
}
}
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\tD.删除信息\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')
{
goto one;
}
else if(a=='D')
{
}
else
{
printf("输入错误!");
system("pause");
goto one;
}
return 0;
}