用C语言,职工信息管理系统具体要求
1、基本信息:如工号、姓名、性别、年龄、学历、住址、电话号码、工资等。
2、各职工信息用结构体来实现,建议使用链表来实现建立、删除、插入等操作。
3、需建立输出文件,将输入的职工信息存储在该文件中。
4、主功能界面要求包含有自己的学号信息
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct workers
{
char jobNo[15]; //职工号
char name[15]; //姓名
char sex[15]; //性别
char birthday[15]; //出生年月
char degree[15]; //学历
char position[15]; //职务
char salary[15]; //工资
char addr[15]; //住址
char tel[15]; //电话
};
//类型定义语句
typedef struct node
{
struct workers data;
struct node *next;
}Node;
//添加信息函数 "尾插法建表"
void Add(Node *worker)
{
Node *p, *q;
char n[10];
q = worker;
while (q->next != NULL)
{
q = q->next;
}
while (1)
{
printf("提示:输入0返回主菜单!\n");
printf("请输入职工号:");
scanf("%s", n);
if (strcmp(n, "0") == 0)
{
break;
}
p = (Node *)malloc(sizeof(Node));
strcpy(p->data.jobNo, n);
printf("请输入姓名:");
scanf("%s", p->data.name);
printf("请输入性别:");
scanf("%s", p->data.sex);
printf("请输入出生年月:");
scanf("%s", p->data.birthday);
printf("请输入学历:");
scanf("%s", p->data.degree);
printf("请输入职务:");
scanf("%s", p->data.position);
printf("请输入工资:");
scanf("%s", p->data.salary);
printf("请输入住址:");
scanf("%s", p->data.addr);
printf("请输入电话:")