当前位置:编程学习 > C/C++ >>

高分急求.只用C语言编写的"职工信息管理系统"程序....

要求:

职工信息包括职1工号,2姓名,3性别,4年龄,5学历,6工资,7住址,8电话等(职工号不相等)。试设计一职工信息管理系统,使之能够提供下列功能:

(1)系统以菜单方式工作

(2)职工信息录入功能(职工信息用文件保存)

(3)职工信息浏览功能

(4)职工信息查询功能,查询方式:

      1)按学历查询

      2)按职工号查询

(5)职工信息删除,修改功能(可选项)。

(一个都不能少的,记得写上注解啊.简单点都可以....)

补充:急求!!!写的好就采纳,最好在这周日之前,另,不要问其它的,概不回答。。。。。
答案:#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<stdlib.h>

#define up 0x4800
#define down 0x5000
#define enter 0x1c0d
#define esc 0x11b
#define y 0x1579
#define n 0x316e

typedef struct data
{
 char kind[2]; /*中图法分类号*/
 char booknum[16]; /*图书编号*/
 char bookname[20]; /*书名*/
 char authorname[10][20]; /*作者*/
 int an;   /*作者数*/
 char publish[20]; /*出版社*/
 char bdate[16]; /*出版日期*/
 int sparenum; /*馆藏数*/
 int lendnum; /*借阅数*/
}Base_info;

typedef struct data1
{
 Base_info base;
 struct data1 *next;
}BASE;

typedef struct data2 /*以后加数据*/
{
 char stuname[20]; /*借阅学生*/
 long stunum;  /*学生号*/
 char lbookname[20]; /*书名*/
 int anum;  /*作者数*/
 char lauthorname[10][20]; /*作者名*/
}Lend_info;

typedef struct data3
{
 Lend_info lend;
 struct data3 *next;
}LEND;

void baseinfo_input(void)  /*输入基本数据函数*/
{
 FILE *fp;
 char ch;
 int i, m;
 Base_info b;

 if ((fp=fopen("D:\\bookinfo.txt","ab")) == NULL)
 {
  printf("\nCannot open the file.");
  return;
 }

 while (1)
 {
  clrscr();
  printf("\n*****************please input base information***************\n");

  printf("please input book's kind:");
  scanf("%s", b.kind);
  getchar();

  printf("please input the number of book:");
  scanf("%s", b.booknum);
  getchar();

  printf("please input the book's name:");
  scanf("%s", b.bookname);
  getchar();

  printf("please input publish:");
  scanf("%s", b.publish);
  getchar();

  printf("please input publish date:");
  scanf("%s", b.bdate);
  getchar();

  printf("please input spare number of book:");
  scanf("%d", b.sparenum);
  getchar();

  printf("please input lend out book num:");
  scanf("%d", b.lendnum);
  getchar();

  printf("please input how many authors(an<10):");
  scanf("%d", &m);
  getchar();

  b.an=m;
  for (i = 0; i < m; i++)
  {
   printf("please input the author's name:");
   scanf("%s", b.authorname[i]);
   getchar();
  }

  if (fwrite(&b,sizeof(Base_info),1,fp) != 1)
  {
   printf("write error!");
   exit(0);
  }

  printf("\nContinue to input?\n");
  printf("Yes(y)/No(n):");
  ch = bioskey(0);
  putchar(ch);

  while (ch != 'y')
  {
   switch(ch)
   {
    case 'n':
     fclose(fp);
     return;
    case 27:
     fclose(fp);
     return;
    default:
     printf("\nEnter error!Please enter again:");
     ch = bioskey(0);
     putchar(ch);
   }
  }
 }
}

void base_sort(Base_info b[],int count) /*基本信息排序*/
{
 FILE *fp;
 Base_info t;
 int i, j;

 for (i = 0; i < count-1; i++)
 {
  for (j = 0; j < count-i; j++)
  {
   if (strcmp(b[j].bookname, b[j+1].bookname) > 0)
   {
    t = b[j];
    b[j] = b[j+1];
    b[j+1] = t;
   }
  }
 }

 if ((fp=fopen("D:\\bookinfo.txt","rb")) == NULL)
 {
  printf("\nCannot open the file.");
  return;
 }

 for (i = 0; i < count; i++)
 {
  fwrite(&b[i],sizeof(Base_info),1,fp);
 }

 fclose(fp);
}

void lendinfo_input(void) /*借阅信息输入*/
{
 FILE *fp;
 char ch;
 int a, i;
 Lend_info l;

 if ((fp = fopen("D:\\lend_inf.txt", "ab")) == NULL)
 {
  printf("cannot open file.");
  return;
 }

 while(1)
 {
  clrscr();
  printf("*************please input lend information data**************\n");
  printf("please input lend student's name:");
  scanf("%s", l.stuname);
  getchar();

  printf("please input lend student's number:");
  scanf("%ld", l.stunum);
  getchar();

  printf("please input lend bookname:");
  scanf("%s", l.lbookname);
  getchar();

  printf("please input lend how many authors:");
  scanf("%d", &a);
  getchar();

  l.anum=a;
  for (i = 0; i < a; i++)
  {
   printf("please input lend book author:");
   scanf("%s", l.lauthorname[i]);
   getchar();
  }

  if (fwrite(&l, sizeof(Lend_info), 1, fp) != 1)
  {
   printf("Write error!");
   exit(0);
  }

  printf("\nContinue to input?\n");
  printf("Yes(y)/No(n):");
  ch = bioskey(0);
  putchar(ch);

  while(ch != 'y')
  {
   switch(ch)
   {
   case 'n':
    fclose(fp);
    return;
   case 27:
    fclose(fp);
    return;
   default:
    printf("\nEnter error,please enter again:");
    ch = bioskey(0);
    putchar(ch);
   }
  }
 }
}

BASE *base_read(void) /*基本信息读取*/
{
 FILE *fp;
 BASE *head, *p1, *p2;

 if ((fp=fopen("D:\\bookinfo.txt","rb")) == NULL)
 {
  printf("\nCannot open the file.");
  exit(0);
 }

 head=NULL;
 p1=p2=(BASE *)malloc(sizeof(BASE));

 if (fread(p1,sizeof(BASE),1,fp) != 1)
 {
  printf("read error!");
  exit(0);
 }

 while (p1)
 {
  if (head == NULL)
  {
   head = p1;
  }
  else
  {
   p2->next = p1;
  }
  p2=p1;
  p1=(BASE *)malloc(sizeof(BASE));
  fread(p1,sizeof(BASE),1,fp);
  p1=p1->next;
 }
 
 p2->next=NULL;
 fclose(fp);

 return(head);
}

void find(void)  /*基本信息查找输出*/
{
 FILE *fp;
 char name[20];
 int i , flag = 0, max, min, pos, count=0;
 Base_info b[100];

 if((fp=fopen("D:\\bookinfo.txt","rb")) == NULL)
 {
  printf("cannot open file!press any key return.");
  getch(

上一个:C语言中printf()后的括号里面的怎么写,表示什么?
下一个:用C语言写一个控制鼠标键盘自动点的程序复杂吗

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,