91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

【C語言】企業員工信息管理

發布時間:2020-07-24 00:52:12 來源:網絡 閱讀:505 作者:990487026 欄目:開發技術



【C語言】企業員工信息管理



//全部源代碼: 
#include<stdio.h>
   #include<string.h>
  #include<conio.h>
 #include <stdlib.h> 


   #define MAX 100
   char  filename[20];            /*文件名*/
  FILE *fp;
  int n;                  /*當前該廠人數*/
   struct date        /*時間結構體*/
   { int year;
     int mouth;
     int day;
   } ;
   struct person         /*員工信息結構體*/
   { char name[10];      /*姓名*/
     int age;            /*年齡*/
     char job[10];       /*工作*/
     char sex[10];       /*性別*/
     char address[20];   /*地址*/
     char phone[10];     /*電話*/
     struct date in_time; /*入廠時間*/
   }t,worker[MAX];

/*錄入模塊*/
 void input()
 {int i; 
    system("cls");//system("cls");
    printf("\n\n請輸入文件名\n");
  scanf("%s",filename);
  printf("開始輸入員工的信息\n");
  printf("\n請輸入現有員工人數\n");
      scanf("%d",&n);
  if((fp=fopen(filename,"w"))==NULL)
  { printf("不能建立!\n");
    exit(0);
  }
 for(i=0;i<n;i++)
  { printf("第%d個人的信息:\n",i+1);
    printf("姓名\n");
    scanf("%s",worker[i].name);
    printf("年齡\n");
    scanf("%d",&worker[i].age);
    printf("工作\n");
    scanf("%s",worker[i].job);
    printf("性別\n");
    scanf("%s",worker[i].sex);
    printf("地址\n");
    scanf("%s",worker[i].address);
    printf("電話\n");
    scanf("%s",worker[i].phone);
    printf("入廠年\n");
    scanf("%d",&worker[i].in_time.year);
    printf("入廠月\n");
    scanf("%d",&worker[i].in_time.mouth);
    printf("入廠日\n");
    scanf("%d",&worker[i].in_time.day);
  }
  printf("錄入完畢,按任意鍵返回主菜單\n");
  getch();
  for(i=0;i<n;i++)
  fprintf(fp,"%s  %d  %s  %s  %s  %s  %d-%d-%d\n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
  fclose(fp);
}
/*輸出模塊*/
 void output()
 { int i; 
   if((fp=fopen(filename,"r"))==NULL)
 { printf("   暫時未有任何信息,請按任意鍵返回主菜單進行信息錄入\n");
    getch();
    exit(0);
 }
    system("cls");
 printf("   該廠的員工信息:\n");
     printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
   for(i=0;i<n;i++)
   { fscanf(fp,"%s %d %s %s %s %s %d-%d-%d",worker[i].name,&worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,&worker[i].in_time.year,&worker[i].in_time.mouth,&worker[i].in_time.day);
       printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
   }
   fclose(fp);
    printf("   輸出完畢,按任意鍵返回主菜單\n");
     getch();
 }
 /*保存模塊*/
 void save()
 {   int i;
     if((fp=fopen(filename,"w"))==NULL)         /*打開文件*/
     {   printf("\n   不能打開該文件!");
         exit(0);
     }
      for(i=0;i<n;i++)
  fprintf(fp,"%s  %d  %s  %s  %s  %s  %d-%d-%d\n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
  fclose(fp);
 }
 /*讀取信息*/
void read_message()
 {     int i; 
  printf("輸入文件名\n");
    scanf("%s",filename);
    printf("\n請輸入現有員工人數\n");
      scanf("%d",&n);
     if((fp=fopen(filename,"r"))==NULL)
 { printf("   暫時未有任何信息,請按任意鍵返回主菜單進行信息錄入\n");
   getch();
 }
   for(i=0;i<n;i++)
    fscanf(fp,"%s %d %s %s %s %s %d-%d-%d",worker[i].name,&worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,&worker[i].in_time.year,&worker[i].in_time.mouth,&worker[i].in_time.day);
    fclose(fp);
}
/*修改模塊*/
void modify()
 { int i,flag,choice; char ch,namekey[10];
    flag=0;
    system("cls");
  printf("   開始修改\n");
  do
  {
   printf("請輸入要修改的員工姓名\n");
   scanf("%s",namekey);
   for(i=0;i<n;i++)
   { if(strcmp(worker[i].name,namekey)==0)
   { printf("是否修改此人(y/n)\n");
     printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
      printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      getchar();           /*接收回車*/
      ch=getchar();
      if(ch=='y')
      { printf("   ****您要修改那一項?***\n\n");
        printf("   ***1,姓名***\n\n");
        printf("   ***2,年齡***\n\n");
        printf("   ***3,工作***\n\n");
        printf("   ***4,性別***\n\n");
        printf("   ***5,地址***\n\n");
        printf("   ***6,電話***\n\n");
        printf("   ***7,入廠年***\n\n");
        printf("   ***8,入廠月***\n\n");
        printf("   ***9,入廠日***\n\n");
        printf("      請選擇(1-9)\n");
        scanf("%d",&choice);
        switch(choice)
        { case 1: printf("輸入修改后的姓名\n");
                  scanf("%s",worker[i].name); break;
          case 2: printf("輸入修改后的年齡\n");
                  scanf("%d",&worker[i].age);   break;
          case 3: printf("輸入修改后的工作\n");
                  scanf("%s",worker[i].job); break;
          case 4: printf("輸入修改后的性別\n");
                  scanf("%s",worker[i].sex); break;
          case 5: printf("輸入修改后的地址\n");
                  scanf("%s",worker[i].address); break;
          case 6: printf("輸入修改后的電話\n");
                  scanf("%s",worker[i].phone); break;
          case 7: printf("輸入修改后的入廠年\n");
                  scanf("%d",&worker[i].in_time.year); break;
          case 8: printf("輸入修改后的入廠月\n");
                  scanf("%d",&worker[i].in_time.mouth); break;
          case 9: printf("輸入修改后的入廠日\n"); 
                   scanf("%d",&worker[i].in_time.day); break;
        }
        printf("修改后的信息\n");
       printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
      printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
   }
    else break;
   }
   else
   if(i==n)  printf("此人不存在\n");
   }
   printf("\n是否繼續輸入(y/n)\n");
   getchar();           /*接收回車*/
   ch=getchar();
  if(ch=='y')
  { printf("繼續\n");
      flag=1;
  }
  else flag=0;
  }while(flag==1); 
printf("修改完畢,按任意鍵返回主菜單\n") ;
getch();

 }
/*添加模塊*/
void add()
 { int i,flag=0; char ch;
      system("cls");
    printf("\n   開始添加新員工\n");
   printf("   *----------------------------------*\n\n");
do
{ i=n;
   printf("\n   請輸入添加職工的信息(姓名,年齡,工作,性別,地址,電話,入廠時間)\n");   
   printf("姓名\n");
    scanf("%s",worker[i].name);
    printf("年齡\n");
    scanf("%d", &worker[i].age);
    printf("工作\n");
    scanf("%s",worker[i].job);
    printf(" 性別\n");
    scanf("%s",worker[i].sex);
    printf("地址\n");
    scanf("%s",worker[i].address);
    printf("電話\n");
    scanf(" %s",worker[i].phone);
    printf("入廠年\n");
    scanf("%d",&worker[i].in_time.year);
    printf("入廠月\n");
    scanf("%d",&worker[i].in_time.mouth);
    printf("入廠日\n");
    scanf("%d",&worker[i].in_time.day);
    n++;
   printf("\n添加成功!是否繼續輸入(y/n)\n");
  getchar();           /*接收回車*/
  ch=getchar();
  if(ch=='y')
  { printf("繼續\n");
      flag=1;
  }
  else flag=0;
  }while(flag==1); 
    printf("添加完畢,按任意鍵返回主菜單\n") ;
   getch();
 }

/*刪除模塊*/
void  del()
 { int i,flag; char ch,namekey[10];
    flag=0;
    system("cls");
   printf("開始刪除\n");
   do
  { printf("請輸入要刪除員工的名字\n");
    scanf("%s",namekey);
    for(i=0;i<n;i++)
     if(strcmp(worker[i].name,namekey)==0)      /*查找此人*/
   { printf("是否刪除此人(y/n)\n");
       printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
      printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      getchar();           /*接收回車*/
  ch=getchar();
  if(ch=='y')
  { for(;i<n;i++)
    worker[i]=worker[i+1];
    n--;
  }
  else break;
   }
   else
   if(i==n)
    printf("此人不存在\n");
  printf("\n是否繼續輸入(y/n)\n");
  getchar();           /*接收回車*/
  ch=getchar();
  if(ch=='y')
  { printf("繼續\n");
      flag=1;
  }
  else flag=0;
  }while(flag==1); 
  printf("操作完畢,按任意鍵返回主菜單\n") ;
  getch();
 }
   /*更新模塊*/
 void renew()
 { int i;
     do
   {    system("cls");
     printf("\n\n\n    ****更新員工信息****\n\n");
     printf("        按1,添加員工信息\n\n");
     printf("        按2,刪除員工信息\n\n");
     printf("        按3,修改員工信息\n\n");
     printf("        按0,返回主菜單\n");
     printf("        請選擇(0-3)\n");
      scanf("%d",&i);
      switch(i)
      { case 1: add(); break;
        case 2: del(); break;
        case 3: modify(); break;
        case 0: break;
      }
   }while(i!=0);
    save();
 }
  /*按姓名查找*/
void name_cha()
{ int i,j; char namekey[10];
   j=0;
         system("cls");
  printf("        輸入要查詢的員工姓名\n");
  scanf("%s",namekey);
  for(i=0;i<n;i++)
   if(strcmp(worker[i].name,namekey)==0)      /*查找此人*/
   { printf("---------員工信息------\n");
       printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
      printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
   }
   else j++;
   if(j==n)
   printf("此人不存在\n");
   printf("按任意鍵返回主菜單\n");
      getch();
 }
    /*按年齡查找*/
void age_cha()
{ int i,j; int agekey;
   j=0;
       system("cls");
   printf("        輸入要查詢員工的年齡\n");
   scanf("%d",&agekey);
   for(i=0;i<n;i++)
       if(worker[i].age==agekey)
       {  printf("-------員工信息------\n");
          printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
          printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
       }
     else j++;
    if(j==n)
   printf("此人不存在\n");
   printf("按任意鍵返回主菜單\n");
      getch();
}
   /*按工作查找*/
void job_cha()
{ int i,j; char jobkey[10];
  j=0;
     system("cls");
  printf("輸入要查詢的員工職務\n");
  scanf("%s",jobkey);
  for(i=0;i<n;i++)
      if(strcmp(worker[i].job,jobkey)==0)
      {  printf("-------員工信息------\n");
          printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
          printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      }
     else j++;
    if(j==n)
   printf("此人不存在\n");
   printf("按任意鍵返回主菜單\n");
      getch();
    }
  /*查詢模塊*/
 void inquire()
 {  int i;
     do
    {   system("cls");
      printf("\n\n\n   ****查詢員工信息*****\n\n");
      printf("   ****1,按姓名查詢*****\n\n");
      printf("   ****2,按年齡查詢*****\n\n");
      printf("   ****3,按工作查詢*****\n\n");
      printf("   ****0,返回主菜單\n");
      printf("      請選擇(0-3)\n");
      scanf("%d",&i);
      switch(i)
      { case 1: name_cha();break;
        case 2: age_cha(); break;
        case 3: job_cha();break;
        case 0: break;
      }
    }while(i!=0);
  }
/*排列模塊*/
 void line()
 { int i,j;
        system("cls");
   printf("-------按年齡排序-------\n\n");
   for(i=0;i<n-1;i++)
       for(j=i+1;j<n;j++)
           if(worker[i].age>worker[j].age)
           { t=worker[i];
             worker[i]=worker[j];
             worker[j]=t;
           }
       printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
      for(i=0;i<n;i++)
        printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      printf("按任意鍵返回主菜單\n");
      getch();
 }
 /*按年齡統計*/
 void count_age()
 { int i,j; int agekey;
   j=0;
   system("cls");
   printf("        輸入要統計員工的年齡\n");
   scanf("%d",&agekey);
   for(i=0;i<n;i++)
       if(worker[i].age==agekey)
       {  printf("-------員工信息------\n");
            printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
          printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      }
     else j++;
    if(j==n)
   printf("暫無該年齡段員工\n");
   printf("按任意鍵返回主菜單\n");
      getch();
}
/*按職務統計*/
 void count_job()
{ int i,j; char jobkey[10];
  j=0;
       system("cls");
  printf("輸入要統計的員工職務\n");
  scanf("%s",jobkey);
  for(i=0;i<n;i++)
      if(strcmp(worker[i].job,jobkey)==0)
      {  printf("-------員工信息------\n");
          printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
          printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      }
     else j++;
    if(j==n)
   printf("暫無該職務或該職務暫時無人\n");
   printf("按任意鍵返回主菜單\n");
      getch();
}
/*按性別統計*/
 void count_sex()
{ int i,j; char sexkey[10];
  j=0;
       system("cls");
  printf("輸入要統計的員工性別\n");
  scanf("%s",sexkey);
  for(i=0;i<n;i++)
      if(strcmp(worker[i].sex,sexkey)==0)
      {  printf("-------員工信息------\n");
        printf("姓名\t年齡\t工作\t性別\t地址\t電話\t入廠時間 \n");
          printf("%s\t%d\t%s\t%s\t%s\t%s\t%d-%d-%d  \n",worker[i].name,worker[i].age,worker[i].job,worker[i].sex,worker[i].address,worker[i].phone,worker[i].in_time.year,worker[i].in_time.mouth,worker[i].in_time.day);
      }
     else j++;
    if(j==n)
   printf("暫無該性別員工\n");
   printf("按任意鍵返回主菜單\n");
      getch();
}
/*統計模塊*/
 void count()
{ int i; 
   do
   {    system("cls");
     printf("\n\n\n   ****統計員工信息****\n\n");
     printf("        按1,統計某年齡職工\n\n");
     printf("        按2,統計某職務員工\n\n");
     printf("        按3,統計某性別職工\n\n");
     printf("        按0,返回主菜單\n\n");
     printf("        請選擇(0-3):\n");
     scanf("%d",&i);
     switch(i)
     { case 1: count_age(); break;
       case 2: count_job(); break;
       case 3: count_sex(); break;
       case 0: break;
    }
   }while(i!=0);
 }
/*主函數*/
main()
{ int choice;
 read_message();
    do
  {   system("cls");
    printf("\n\n   *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*\n");
    printf("   *                                                             *\n");
    printf("   #----------------歡迎進入XXX企業員工管理系統-----------------#\n");
    printf("   *                                                             *\n");
    printf("   #----------------------按1,錄入員工信息----------------------#\n");
    printf("   *                                                             *\n");
    printf("   #----------------------按2,更新員工信息----------------------#\n");
    printf("   *                                                             *\n");
    printf("   #----------------------按3,查詢員工信息----------------------#\n");
    printf("   *                                                             *\n");
    printf("   #----------------------按4,排列員工信息----------------------#\n");
    printf("   *                                                             *\n");
    printf("   #----------------------按5,統計員工信息----------------------#\n");
    printf("   *                                                             *\n");
    printf("   #----------------------按6,輸出員工信息----------------------#\n");
    printf("   *                                                             *\n");
    printf("   #-----------------------按0,退出系統-------------------------#\n");
    printf("   *                                                             *\n");
    printf("   #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#\n");
    scanf("%d",&choice);
    switch(choice)
    { case 1: input(); break;
      case 2: renew(); break;
      case 3: inquire(); break;
      case 4: line(); break;
      case 5: count(); break;
      case 6: output(); break;
      case 0: break;
    }
  }while(choice!=0);
  save();
  printf("現有員工數:%d\n",n);
  printf("\n以上信息已保存!文件名為:%s\n",filename);
 }




向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

雷州市| 沾益县| 永春县| 扎兰屯市| 武宁县| 华蓥市| 怀化市| 海安县| 托克逊县| 始兴县| 怀远县| 新宾| 福安市| 铁岭县| 济宁市| 永康市| 八宿县| 托里县| 临沭县| 广州市| 柞水县| 咸阳市| 林西县| 苏尼特右旗| 鹿邑县| 汶上县| 平和县| 大厂| 威宁| 凤翔县| 海南省| 乡城县| 将乐县| 卓尼县| 泽普县| 琼海市| 霍山县| 临洮县| 广德县| 子洲县| 视频|