| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2549 人关注过本帖, 1 人收藏
标题:利用C语言设计开发小型的员工工资管理信息系统。
取消只看楼主 加入收藏
晨簌馨
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2015-4-9
结帖率:100%
收藏(1)
 问题点数:0 回复次数:1 
利用C语言设计开发小型的员工工资管理信息系统。
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 3
int n=0;
typedef struct employee
{
 long num;    /*工号*/
  char name[50];  /*名字*/
  int age;     /*年龄*/
  char department[10];  /*部门*/
  int salary;/*工资*/
}EMPLOYEE;
int selectmenu();
void input(EMPLOYEE employee[]);     /*输入*/
void output(EMPLOYEE employee[]);    /*输出*/
void inquire(EMPLOYEE employee[]);    /*查询*/
int search(EMPLOYEE employee[],int n,long x);




EMPLOYEE employee[N];
void main()
{

   int password=123456;        
   int q;
   int w;
   printf("你只有一次录入密码的机会\n");
   printf("\n\n请输入密码:");
   scanf("%d",&w);
   printf("\n");
   if(password==w)
   {
      q=selectmenu();
       while(1)
       {
          switch(q)
          {
          case 1:
              input(employee);   break;       /*输入输入员工信息*/
          case 2:
              output(employee);    break;       /*显示员工信息*/
          case 3:
              inquire(employee);  break;        /*输入员工卡号来查询员工信息*/
         
 /*根据员工年龄来进行排序  */
          case 0:
              exit(0);     break;    /*退出*/
          }
         
          q=selectmenu();
       }
   }
   else
       printf("输入密码错误!\n");
}
int selectmenu()      /*菜单栏*/
{
    int q;
    printf("\n\n_________________________________________________________\n\n");
    printf("\n\n                        选择栏                         \n\n");
    printf("\t\n----------------------------------------------------------------------------\n");
    printf("\t\n********1.输入员工信息                                           ********");
    printf("\t\n********2.显示员工信息                                           ********");
    printf("\t\n********3.输入员工卡号来查询员工信息                             ********");
    printf("\t\n********4.根据员工年龄来进行排序                                 ********");
    printf("\t\n********0.退出程序                                               ********");
    printf("\t\n----------------------------------------------------------------------------\n");
    printf("\t请选择菜单号(0--4):");
    while((!scanf("%d",&q)||(q<0)||(q>4)))
    {
        printf("输入有误,请重新输入");
        printf("\n\n_________________________________________________________\n\n");
        printf("\n\n                        选择栏                         \n\n");
        printf("\t\n----------------------------------------------------------------------------\n");
        printf("\t\n********1.输入员工信息                                           ********");
        printf("\t\n********2.显示员工信息                                           ********");
          printf("\t\n********3.输入员工卡号来查询员工信息                             ********");
        printf("\t\n********4.根据员工年龄来进行排序                                 ********");
        printf("\t\n********0.退出程序                                               ********");
        printf("\t\n----------------------------------------------------------------------------\n");
        printf("\t请选择菜单号(0--4):");
    }
    return q;
}
void input(EMPLOYEE employee[])
{
   int n;
   printf("\n有多少名员工:");
   scanf("%d",&n);
    do
    {
            printf("\n输入员工工号(按0结束录入):");
             scanf("%ld",&employee[n].num);
              if(employee[n].num==0)    break;
        for(int i=0;i<n;i++)
        {
        
           while(employee[n].num==employee[i].num)
           {
               printf("\n该员工已经录入,请重新录入:");
               scanf("%ld",&employee[n].num);
               if(employee[n].num==0)   break;
               
           }
               printf("\n输入员工姓名:");
        scanf("%s",&employee[i].name);
        printf("\n输入员工年龄:");
        scanf("%d",&employee[i].age);
        if((employee[i].age<18)||(employee[i].age>60))
        {
            printf("\n员工年龄超出年龄范围18-60岁,请重新输入:");
        scanf("%d",&employee[i].age);
         
        }
        printf("\n输入员工工作部门:");
        scanf("%s",&employee[i].department );
        printf("\n输入员工工资:");
        scanf("%d",&employee[i].salary);
    n++;
        }
   
        printf("\n");
    }while(n<=20);
        printf("\n\n-------------------------------------------------------------\n\n");
}
void output(EMPLOYEE employee[])
{

       printf("\n\n-------------------------------------------------------------\n\n");
    printf("\n                             员工信息  \n\n\n");
    printf("工号\t姓名\t年龄\t部门\t工资\t\n");
    for(int i=0;i<n;i++)
    {
    printf("%ld\t%s\t%d\t%s\t%d\t",employee[n].num,employee[n].name,employee[n].age,employee[n].department,employee[n].salary);
    }
       printf("\n\n-------------------------------------------------------------\n\n");


}
void inquire(EMPLOYEE employee[])
{
     long x;
     printf("输入员工卡号:");
     scanf("%ld",&x);
     int p;
     p=search(employee,n,x);
     if(p!=-1)
     {
        printf("    员工姓名:%s\t\n",employee[p].name);
        printf("    员工年龄:%d\t\n",employee[p].age );
        printf("    员工部门:%s\t\n",employee[p].department );
        printf("    员工工资:%d\t\n",employee[p].salary );
     }
     else
     {
         printf("没有此员工信息");
     }
}
int search(EMPLOYEE employee[],int n,long x)
{
     int i;
      for(i=0;i<n;i++)
    {
        if(employee[i].num==x)
            return(i);
    }
    return -1;
}



想编一套员工工资管理系统,但是好像出了问题,求大神帮我看看,哪里有问题。没出错误
搜索更多相关主题的帖子: department employee include search C语言 
2015-05-30 13:33
晨簌馨
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2015-4-9
收藏
得分:0 
这个有一个错误
【Linking...
文.obj : error LNK2001: unresolved external symbol "void __cdecl input(struct employee * const,int)" (?input@@YAXQAUemployee@@H@Z)
Debug/文.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

文.exe - 1 error(s), 0 warning(s)】
2015-05-31 14:44
快速回复:利用C语言设计开发小型的员工工资管理信息系统。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031789 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved