标题:员工管理系统,做出部分,求大神帮忙修改错误
只看楼主
x444999
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-1-3
结帖率:0
已结贴  问题点数:20 回复次数:3 
员工管理系统,做出部分,求大神帮忙修改错误
#include<stdio.h>
#include<string.h>
#define N 200
#define LEN sizeof(struct employee)
#define FORMAT "%d       %s       %s       %s       %d       %s       %d        %s"
#define DATA em[i].num,em[i].name,em[i].position,em[i].sex,em[i].age,em[i].cult,em[i].salary,em[i].state;     
void manage();
void query();
void input();
void display();
void change();
void add();
void del();
void count();
void searchnum();
void searchname();
void manage2();
struct employee
{
    int num;
    char position[20];
    char name[20];
    char sex[2];
    int age;
    char cult[10];
    int salary;
    char state[8];
}em[N];
struct communication
{
    char name[8];
    char officete[13];
    char hometel[13];
    char handtel[13];
    char address[13];
}empc[N];
main()
{
    char password[7]="123456",s[7];
    int flag,n=3,choice;
   
    do
    {
        printf("请你输入密码:\n");
        scanf("%s",s);
        if(!strcmp(s,password))
        {
            printf("恭喜你成功登陆了\n\n\n");
            flag=1;
            break;
        }
        else
        {
            printf("输入错误请重新输入:\n");
            n--;
        }
    }
    while(n>0);
    {
        
        printf("~~~~~~~~~~~~~~~\t\t\t\t~~~~~~~~~~~~~~~~\n");
        printf("\t\t欢迎进入职工管理系统中文版\n");
        printf("制作人:\t 班级:\t 学号:\n");
        printf("联系地址:\n");
        printf("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
        printf("\t\t请你选择操作类型:\n");
        printf("================\t\t\t=================\n");
        printf("\t\t1 进入管理系统\n");
        printf("\t\t2 进入查询系统\n");
        printf("\t\t3 进入通讯录  \n");
        printf("\t\t0 退出系统    \n");
        printf("================\t\t\t================\n");
        printf("说明:版权归作者所有,违者必究\n\n\n\n");
        scanf("%d",&choice);
        switch(choice)
        {
        case 1:
            {
                manage();
                break;
            }
        case 2:
            {
                query();
                break;
            }
        case 3:
            {
                communication();
                break;
            }
        case 0:
            {
                printf("谢谢使用,再见");
                exit(0);
            }
        default:
            {
                printf("输入有错误,请重新输入:\n");
                return (0);
        }
    }
}
{
    FILE*fp;
    int i=0;
    char choiceinput='y';
    if((fp=fopen("employee.txt","a++"))==NULL)
        return;
    while(choiceinput=='y'||choiceinput=='Y')
    {
        i++;
        printf("第%d个职工\n",i);
        printf("\n");
        printf("请你输入工号:\n");
        scanf("%d",&em[i].num);
        printf("\n");
        printf("请你输入职位(董事长/总经理/副总经理/经理/副经理/秘书/技术员/领班/员工):\n");
        scanf("%s"em[i].positon);
        printf("\n");
        printf("请你输入姓名:\n");
        scanf("%s",em[i].name);
        printf("\n");
        printf("请你输入性别(男或女):\n");
        scanf("%s",em[i].sex);
        printf("\n");
        printf("请你输入文化程度(专家/博士/硕士/学士/其他)":/n);
        scanf("%s",em[i].cult);
        printf("\n");
        printf("请你输入工资:\n");
        scanf("%d",&em[i].salary);
        printf("\n");
        printf("请你输入身体情况(健康/良好/一般/差):\n");
        scanf("%s",em[i].state);
        printf("\n");
        printf("是否继续输入?(y/n)\n");
        scanf("%s",&choiceceinput);
        fwrite(&em[i].LEN,1,fp);
    }
    if(toupper(choiceinput)=='N')
    {fclose(fp);
    printf("输入完毕,任意键返回\n");
    getch;
    return;
    }
}
搜索更多相关主题的帖子: employee 管理系统 display include change 
2016-01-03 21:07
x444999
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2016-1-3
得分:0 
求大神帮忙啊,明天就要被检查的一段程序……
真心很急
2016-01-03 21:28
eFun
Rank: 6Rank: 6
等 级:禁止访问
威 望:1
帖 子:58
专家分:400
注 册:2015-12-27
得分:10 
自己写的自己就一定能改。否则怎么说:解铃还需系铃人!
2016-01-04 07:14
倪晖
Rank: 2
等 级:论坛游民
帖 子:1
专家分:10
注 册:2015-5-7
得分:10 
#include<stdio.h>
#include<string.h>
#include <stdlib.h>

#define N 200
//#define LEN sizeof(struct employee)
#define FORMAT "%d       %s       %s       %s       %d       %s       %d        %s"
#define DATA em[i].num,em[i].name,em[i].position,em[i].sex,em[i].age,em[i].cult,em[i].salary,em[i].state;     

void manage();
void query();
void input();
void display();
void change();
void add();
void del();
void count();
void searchnum();
void searchname();
void manage2();

struct employee
{
    int num;
    char position[20];
    char name[20];
    char sex[2];
    int age;
    char cult[10];
    int salary;
    char state[8];
} em[N];

struct communication
{
    char name[8];
    char officete[13];
    char hometel[13];
    char handtel[13];
    char address[13];
} empc[N];

int main()
{
    char password[7]="123456",s[7];
    int flag,n=3,choice;
   
    do
    {
        printf("请你输入密码:\n");
        scanf("%s",s);
        if(!strcmp(s,password))
        {
            printf("恭喜你成功登陆了\n\n\n");
            flag=1;
            break;
        }
        else
        {
            printf("输入错误请重新输入:\n");
            n--;
        }
    }
    while(n>0);
    {
        
        printf("~~~~~~~~~~~~~~~\t\t\t\t~~~~~~~~~~~~~~~~\n");
        printf("\t\t欢迎进入职工管理系统中文版\n");
        printf("制作人:\t 班级:\t 学号:\n");
        printf("联系地址:\n");
        printf("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
        printf("\t\t请你选择操作类型:\n");
        printf("================\t\t\t=================\n");
        printf("\t\t1 进入管理系统\n");
        printf("\t\t2 进入查询系统\n");
        printf("\t\t3 进入通讯录  \n");
        printf("\t\t0 退出系统    \n");
        printf("================\t\t\t================\n");
        printf("说明:版权归作者所有,违者必究\n\n\n\n");
        scanf("%d",&choice);
        switch(choice)
        {
        case 1:
            {
                //manage(void);
                break;
            }
        case 2:
            {
                //query();
                break;
            }
        case 3:
            {
                //communication();
                break;
            }
        case 0:
            {
                printf("谢谢使用,再见");
                exit(0);
            }
        default:
            {
                printf("输入有错误,请重新输入:\n");
                return (0);
            }
        }   
    }

    FILE*fp;
    int i=0;
    char choiceinput='y';
    if((fp=fopen("employee.txt","a++"))==NULL)
        return;
    while(choiceinput=='y'||choiceinput=='Y')
    {
        i++;
        printf("第%d个职工\n",i);
        printf("\n");
        printf("请你输入工号:\n");
        scanf("%d",&em[i].num);
        printf("\n");
        printf("请你输入职位(董事长/总经理/副总经理/经理/副经理/秘书/技术员/领班/员工):\n");
        scanf("%s", &em[i].position);
        printf("\n");
        printf("请你输入姓名:\n");
        scanf("%s",em[i].name);
        printf("\n");
        printf("请你输入性别(男或女):\n");
        scanf("%s",em[i].sex);
        printf("\n");
        printf("请你输入文化程度(专家/博士/硕士/学士/其他):/n");
        scanf("%s",em[i].cult);
        printf("\n");
        printf("请你输入工资:\n");
        scanf("%d",&em[i].salary);
        printf("\n");
        printf("请你输入身体情况(健康/良好/一般/差):\n");
        scanf("%s",em[i].state);
        printf("\n");
        printf("是否继续输入?(y/n)\n");
        scanf("%s",&choiceinput);
        //fwrite(&em[i].LEN,1,fp);
    }
   
    if(toupper(choiceinput)=='N')
    {
        fclose(fp);
        printf("输入完毕,任意键返回\n");
        getchar();
        return 0;
    }
}
2016-01-05 23:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-460790-1-1.html




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

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