宿舍管理系统(精简版)

要求:管理员要有增删改查的权限,普通用户要有查询自已信息和更改自身信息的权限。

电脑c盘根目录下要有rizhi.txt和rizhi.txt1的文件,文件中要有相应的信息供提取。

例如:

rizhi.txt是普通用户的信息存储文件:

狂盗一枝梅 15020962290 12110501001 男 50000 21 1
狂盗一枝梅 15020962292 12110501001 男 50000 21 1
狂盗一枝梅 15020962293 12110501001 男 50000 21 1
狂盗一枝梅 15020962294 12110501001 男 50000 21 1
狂盗一枝梅 15020962295 12110501001 男 50000 21 1
狂盗一枝梅 15020962296 12110501001 男 50000 21 1
狂盗一枝梅 15020962297 12110501001 男 50000 21 1
狂盗一枝梅 15020962298 12110501001 男 50000 21 1
狂盗一枝梅 15020962299 12110501001 男 50000 21 1
狂盗一枝梅 15020962210 12110501001 男 50000 21 1

 rizhi1.txt是管理用户的信息存储文件:

超级管理员 12110501000 15020962291 男 789 45 1
超级管理员 12110501002 15020962291 男 789 45 1
超级管理员 12110501003 15020962291 男 789 45 1
超级管理员 12110501004 15020962291 男 789 45 1
超级管理员 12110501005 15020962291 男 789 45 1
超级管理员 12110501006 15020962291 男 789 45 1
超级管理员 12110501007 15020962291 男 789 45 1
超级管理员 12110501008 15020962291 男 789 45 1
超级管理员 12110501009 15020962291 男 789 45 1
超级管理员 12110501010 15020962291 男 789 45 1

 

   1 #include<stdio.h>2 #include<string.h>3 #include<stdlib.h>4 #include<windows.h>5 #include<time.h>6 int sum=0,sumsup=0;7 struct vode8 {9     int nianling,gongzi,zhuangtai;10     char  ip[60],mima[60];11     char xingming[60],xingbie[60];12 }f[3000],sup[3000];13 void loadsup();14 void mohuchazhao ();15 void gengxin();16 void load();17 void search1();18 int check(char m[],char n[]);19 int checksup(char m[],char n[]);20 void inseart();21 void delete1();22 void change();23 int search(char m[]);24 void splash();25 void login();26 void mainmenue(int m);27 void output(char m[]);28 void input();29 void change1(char m[]);30  int main()31 {32     splash();33     load();34     loadsup();35     printf("现在所有的用户总数是:sum=%d sumsup=%d\n",sum,sumsup);36     //output(f[sum-1].ip);37     //gengxin();38     login();39     return 0;40 }41 void splash()42 {43     srand((unsigned)time(NULL));44     int i,j;45     for(j=0;j<=10;j++)46     {47         printf("\n");48         for(i=0;i<=30;i++)49         printf(" ");50         printf("     欢迎!!!\n\n");51         printf("\t  ┌────────────────────────────┐\n");52         printf("\t  │                 职工信息管理系统                       │\n");53         printf("\t  │开发环境:codeblocks编译器                              │\n");54         printf("\t  │团队名称:非常文静                                      │\n");55         printf("\t  │开发者:鲁文娜,马静,徐杰,郑荣军,臧效杰              │\n");56         printf("\t  │                                                        │\n");57         printf("\t  ├────────────────────────────┤\n");58         if(j<10)59         {60             printf("\n");61             for(i=0;i<=30;i++)62             printf(" ");63         printf("  正在加载........\n\n");64         }65         else66         {67             printf("\n");68                for(i=0;i<=31;i++)69                  printf(" ");70            printf("   加载完成!!\n\n");71         }72         for(i=0;i<=30;i++)73             printf(" ");74         printf("   已加载:");75         printf("%d",j*10);76         printf("%c",'%');77         printf("\n\n");78         for(i=0;i<=1;i++)79             printf(" ");80         for(i=0;i<=37;i++)81       {82           printf("▍");83           Sleep(8);84       }85         printf("\n\n");86         if(j==10)87         {88                printf("\t\t\t   ┌────────────┐\n");89                printf("\t\t\t   │按任意键进入登陆页面!!│  \n");90                printf("\t\t\t   └────────────┘\n");91              system("pause");92         }93         system("cls");94     }95 }96 void login()97 {98      printf("\t   ┌────────────┐  ┌────────────┐\n");99      printf("\t   │    普通用户登陆:      │  │    管理员用户登陆:    │\n");100      printf("\t   │                        │  │                        │\n");101      printf("\t   │   按1进入登陆页面!    │  │   按2进入登陆页面!    │\n");102      printf("\t   │                        │  │                        │\n");103      printf("\t   └────────────┘  └────────────┘\n");104      printf("\t   ┌─────────────┬─────────────┐\n");105      printf("\t   │                                                      │\n");106      printf("\t   │                       按0退出!                      │\n");107      printf("\t   │                                                      │\n");108      printf("\t   └─────────────┴─────────────┘\n");109      int n;110      scanf("%d",&n);111        mainmenue(n);112 }113 void mainmenue(int n)114 {115      if(n==1)116         {117             char h[2][60];118            Sleep(1000);119           system("cls");120            while(1)121           {122               printf("\n\t\t\t┌──┐│");123               printf("\n\t\t\t│账户││");124               printf("\n\t\t\t└──┘│");125               scanf("\n\t\t\t\t%s",h[0]);126               printf("\n\t\t\t┌──┐│");127               printf("\n\t\t\t│密码││");128               printf("\n\t\t\t└──┘│");129           scanf("%s",h[1]);130           //调用函数判断账户和密码是否正确131           int s=check(h[0],h[1]);132           Sleep(1000);133                   system("cls");134           if(s==2)135           {136               printf("\n\n\n\n");137               printf("\t\t\t┌───────────┐\n");138               printf("\t\t\t│您已经成功登录本系统!│\n");139               printf("\t\t\t└───────────┘\n");140               Sleep(1500);141               system("cls");142               break;143           }144           if(s==1) {145                printf("\t\t\t┌─────────┐\n");146                printf("\t\t\t│    密码错误!    │\n");147                printf("\t\t\t└─────────┘\n");148                Sleep(2500);149                system("cls");150      printf("\t   ┌────────────┐  ┌────────────┐\n");151      printf("\t   │          按1:         │  │          按2:         │\n");152      printf("\t   │                        │  │                        │\n");153      printf("\t   │   重新输入账户和密码! │  │     返回上一级!       │\n");154      printf("\t   │                        │  │                        │\n");155      printf("\t   └────────────┘  └────────────┘\n");156      printf("\t   ┌─────────────┬─────────────┐\n");157      printf("\t   │                                                      │\n");158      printf("\t   │                       按0退出!                      │\n");159      printf("\t   │                                                      │\n");160      printf("\t   └─────────────┴─────────────┘\n");161            int m;162            scanf("%d",&m);163            if(m==0)164            {165                printf("\t\t\t\t   ┌─────┐\n");166                printf("\t\t\t\t   │您已退出!│  \n");167                printf("\t\t\t\t   └─────┘\n");168                Sleep(1000);169                system("cls");170                exit(0);171            }172             if(m==1)continue;173            if(m==2)174            {175                Sleep(500);176                system("cls");177                login();178            }179           }180         else  if(s==0)181           {182 printf("\t\t\t┌─────────┐\n");183 printf("\t\t\t│    账号错误!    │\n");184 printf("\t\t\t└─────────┘\n");185                Sleep(2500);186                system("cls");187           }188         else   if(s==3)189           {190                printf("\t\t\t┌──────────┐\n");191                printf("\t\t\t│账号与密码不匹配!!│  \n");192                printf("\t\t\t└──────────┘\n");193           }194           else195           {196                  printf("\t\t┌────────────────────┐\n");197                  printf("\t\t│您的输入有误!!即将自动返回登陆界面!!│\n");198                  printf("\t\t└────────────────────┘\n");199                  Sleep(2000);200                  system("cls");201                  login();202           }203           }204           system("cls");205          printf("\n\n\n\n\n\n\n");206          printf("\t\t┌─────────────────────┐\n");207          printf("\t\t│普通用户只能进行查询和修改自身资料的权限!│\n");208          printf("\t\t└─────────────────────┘\n");209           Sleep(2000);210           system("cls");211           while(1)212           {213      printf("\t   ┌───────────┐┌───────────┐\n");214      printf("\t   │          按1:        ││         按2:        │\n");215      printf("\t   │                      ││                      │\n");216      printf("\t   │     进入查询页面!   ││   进入修改资料页面! │\n");217      printf("\t   │                      ││                      │\n");218      printf("\t   └───────────┘└───────────┘\n");219      printf("\t   ┌───────────┐┌───────────┐\n");220      printf("\t   │          按3:        ││         按0:        │\n");221      printf("\t   │                      ││                      │\n");222      printf("\t   │     返回登录页面!   ││    退出登陆页面 !   │\n");223      printf("\t   │                      ││                      │\n");224      printf("\t   └───────────┘└───────────┘\n");225           int t;226          scanf("%d",&t);227          switch(t)228           {229                case 0:230                printf("\t\t\t\t   ┌─────┐\n");231                printf("\t\t\t\t   │您已退出!│  \n");232                printf("\t\t\t\t   └─────┘\n");233                Sleep(1000);234                system("cls");235                exit(0);236                break;237             case 3:238                 Sleep(1000);239                 system("cls");240                 login();241                 break;242             case 1:243                   Sleep(1000);244                   system("cls");245                   if(!search(h[0]))246                   {247                       printf("\t\t\t┌───────┐\n");248                       printf("\t\t\t│用户不存在!!│\n");249                       printf("\t\t\t└───────┘\n");250                   }251                   else252                   {253                       output(h[0]);254                   }255                   break;256               case 2:257                   Sleep(1000);258                   system("cls");259                   if(!search(h[0]))260                   {261                     printf("\t\t\t┌───────┐\n");262                     printf("\t\t\t│用户不存在!!│\n");263                     printf("\t\t\t└───────┘\n");264                   }265                   else266                  {267                      change1(h[0]);268                  }269                   break;270             default :271                  printf("\t\t┌────────────────────┐\n");272                  printf("\t\t│您的输入有误!!即将自动返回登陆界面!!│\n");273                  printf("\t\t└────────────────────┘\n");274                  Sleep(2000);275                  system("cls");276                  login();277          }278 279         }280         }281     else  if(n==2)282      {283          char h[2][60];284            Sleep(1000);285           system("cls");286            while(1)287           {288               printf("\n\t\t\t┌──┐│");289               printf("\n\t\t\t│账户││");290               printf("\n\t\t\t└──┘│");291               scanf("\n\t\t\t\t%s",h[0]);292               printf("\n\t\t\t┌──┐│");293               printf("\n\t\t\t│密码││");294               printf("\n\t\t\t└──┘│");295           scanf("%s",h[1]);296           //调用函数判断账户和密码是否正确297           int s=checksup(h[0],h[1]);298           Sleep(1000);299                   system("cls");300           if(s==2)301           {302               printf("\n\n\n\n");303               printf("\t\t\t┌───────────┐\n");304               printf("\t\t\t│您已经成功登录本系统!│\n");305               printf("\t\t\t└───────────┘\n");306               Sleep(1500);307               system("cls");308               break;309           }310           if(s==1) {311                printf("\t\t\t┌─────────┐\n");312                printf("\t\t\t│    密码错误!    │\n");313                printf("\t\t\t└─────────┘\n");314                Sleep(2500);315                system("cls");316      printf("\t   ┌────────────┐  ┌────────────┐\n");317      printf("\t   │          按1:         │  │          按2:         │\n");318      printf("\t   │                        │  │                        │\n");319      printf("\t   │   重新输入账户和密码! │  │     返回上一级!       │\n");320      printf("\t   │                        │  │                        │\n");321      printf("\t   └────────────┘  └────────────┘\n");322      printf("\t   ┌─────────────┬─────────────┐\n");323      printf("\t   │                                                      │\n");324      printf("\t   │                       按0退出!                      │\n");325      printf("\t   │                                                      │\n");326      printf("\t   └─────────────┴─────────────┘\n");327            int m;328            scanf("%d",&m);329            if(m==0)330            {331                printf("\t\t\t\t   ┌─────┐\n");332                printf("\t\t\t\t   │您已退出!│  \n");333                printf("\t\t\t\t   └─────┘\n");334                Sleep(1000);335                system("cls");336                exit(0);337            }338             if(m==1)continue;339            if(m==2)340            {341                Sleep(500);342                system("cls");343                login();344            }345           }346         else  if(s==0)347           {348                printf("\t\t\t┌─────────┐\n");349                printf("\t\t\t│    账号错误!    │\n");350                printf("\t\t\t└─────────┘\n");351                Sleep(2500);352                system("cls");353           }354         else if(s==3)355           {356                printf("\t\t\t┌──────────┐\n");357                printf("\t\t\t│账号与密码不匹配!!│  \n");358                printf("\t\t\t└──────────┘\n");359           }360           else361           {362                  printf("\t\t┌────────────────────┐\n");363                  printf("\t\t│您的输入有误!!即将自动返回登陆界面!!│\n");364                  printf("\t\t└────────────────────┘\n");365                  Sleep(2000);366                  system("cls");367                  login();368           }369           }370      while(1)371      {372      printf("\t   ┌───────────┐┌───────────┐\n");373      printf("\t   │          按1:        ││         按2:        │\n");374      printf("\t   │                      ││                      │\n");375      printf("\t   │      增加新用户!    ││     删除原有用户!   │\n");376      printf("\t   │                      ││                      │\n");377      printf("\t   └───────────┘└───────────┘\n");378      printf("\t   ┌───────────┐┌───────────┐\n");379      printf("\t   │          按3:        ││         按4:        │\n");380      printf("\t   │                      ││                      │\n");381      printf("\t   │     查询用户资料!   ││    修改用户资料!    │\n");382      printf("\t   │                      ││                      │\n");383      printf("\t   └───────────┘└───────────┘\n");384      printf("\t   ┌───────────┐┌───────────┐\n");385      printf("\t   │          按5:        ││         按0:        │\n");386      printf("\t   │                      ││                      │\n");387      printf("\t   │      返回登陆页面!  ││       退出登录!     │\n");388      printf("\t   │                      ││                      │\n");389      printf("\t   └───────────┘└───────────┘\n");390      int t;391      scanf("%d",&t);392      switch (t)393      {   //以后为管理员用户功能!394 395              case 0:396                printf("\t\t\t\t   ┌─────┐\n");397                printf("\t\t\t\t   │您已退出!│  \n");398                printf("\t\t\t\t   └─────┘\n");399                Sleep(1000);400                system("cls");401                exit(0);402                break;403              case 1:404                       Sleep(1000);405                       system("cls");406                       inseart();407                       break;//管理员用户增加用户功能函数408              case 2:Sleep(1000);409                   system("cls");410                   delete1();411                  break;//管理员过户删除用户功能函数412              case 3:Sleep(1000);413                    system("cls");414                    printf("\t\t┌────────────────────┐│\n");415                    printf("\t\t│您要进行模糊查找吗?是请按1,不是请按2!││\n");416                    printf("\t\t└────────────────────┘│");417                    int sn;418                    scanf("%d",&sn);419                    if(sn==1)420                     mohuchazhao();421                   else  if(sn==2)422                    search1();423                    else {424                         printf("您的输入有误!");425                         login();426                         }427                  break;//管理员用户查询功能函数428              case 4:Sleep(1000);429                     system("cls");430                     change();431                     break;//管理员用户修改功能函数432              case 5:433                  Sleep(1000);434                  system("cls");435                  login();436                  break;437              default :438                  printf("\t\t┌────────────────────┐\n");439                  printf("\t\t│您的输入有误!!即将自动返回登陆界面!!│\n");440                  printf("\t\t└────────────────────┘\n");441                  Sleep(2000);442                  system("cls");443                  login();444      }445      }446      }447     else if(n==0)448      {449                printf("\t\t\t\t   ┌─────┐\n");450                printf("\t\t\t\t   │您已退出!│  \n");451                printf("\t\t\t\t   └─────┘\n");452                Sleep(1000);453                system("cls");454                exit(0);455      }456      else457      {458                       printf("\t\t\t       ┌───────┐\n");459                       printf("\t\t\t       │您的输入有误!│\n");460                       printf("\t\t\t       └───────┘\n");461                  Sleep(1500);462                  system("cls");463                  login();464      }465 }466 void inseart()467 {468     printf("\t\t\t┌────────────────────┐\n");469     printf("\t\t\t│添加管理员用户请按1,添加普通用户请按2!│\n");470     printf("\t\t\t└────────────────────┘\n");471     int n;472     FILE *fp;473     while(1)474     {475     scanf("%d",&n);476     if(n==2)477     {478     fp=fopen("c://rizhi.txt","a");479     break;480     }481   else if(n==1)482     {483     fp=fopen("c://rizhi1.txt","a");484     break;485     }486   else487   {488       printf("\t\t");489       printf("\t\t输入不符合要求,请重新输入!!\n");490       Sleep(1500);491   }492     }493     if(n==2)494     {495     while(1)496     {497         {498                         printf("\t\t   ┌───────┐│\n");499                         printf("\t\t   │请输入姓名 : ││  \n");500                         printf("\t\t   └───────┘│");501         }502         scanf("%s",f[sum].xingming);503         fflush(stdin);504         {505                         printf("\t\t   ┌───────┐│\n");506                         printf("\t\t   │请输入职工号:││  \n");507                         printf("\t\t   └───────┘│");508         }509         scanf("%s",f[sum].ip);510         if(search(f[sum].ip)==1)511             {512             system("cls");513             printf("\n\n\n\n\n");514             printf("\t\t\t┌────────┐\n");515             printf("\t\t\t│账号已存在!!  │\n");516             printf("\t\t\t└────────┘\n");517             Sleep(1000);518             system("cls");519             continue;520             }521         else break;522     }523         fflush(stdin);524         fprintf(fp,"%s ",f[sum].xingming);525         fprintf(fp,"%s ",f[sum].ip);526         {527                         printf("\t\t   ┌───────┐│\n");528                         printf("\t\t   │请输入密码 : ││  \n");529                         printf("\t\t   └───────┘│");530         }531         scanf("%s",f[sum].mima);532         fflush(stdin);533         fprintf(fp,"%s ",f[sum].mima);534         {535                         printf("\t\t   ┌───────┐│\n");536                         printf("\t\t   │请输入性别 : ││  \n");537                         printf("\t\t   └───────┘│");538         }539         scanf("%s",f[sum].xingbie);540         fflush(stdin);541         fprintf(fp,"%s ",f[sum].xingbie);542         {543                         printf("\t\t   ┌───────┐│\n");544                         printf("\t\t   │请输入工资 : ││  \n");545                         printf("\t\t   └───────┘│");546         }547         scanf("%d",&f[sum].gongzi);548         fflush(stdin);549         fprintf(fp,"%d ",f[sum].gongzi);550         {551                          printf("\t\t   ┌───────┐│\n");552                         printf("\t\t   │请输入年龄 : ││  \n");553                         printf("\t\t   └───────┘│");554         }555         scanf("%d",&f[sum].nianling);556         fflush(stdin);557         fprintf(fp,"%d ",f[sum].nianling);558         f[sum].zhuangtai=1;559         fflush(stdin);560         fprintf(fp,"%d\n",f[sum].zhuangtai);561         sum++;562         Sleep(1500);563         system("cls");564         printf("\n\n\n\n\n");565         printf("\t\t  \t ┌────────┐\n");566         printf("\t\t  \t │已经录入成功!!│\n");567         printf("\t\t  \t └────────┘\n");568         Sleep(1500);569         system("cls");570     }571     if(n==1)572         {573     while(1)574     {575         {576                         printf("\t\t   ┌───────┐│\n");577                         printf("\t\t   │请输入姓名 : ││  \n");578                         printf("\t\t   └───────┘│");579         }580         scanf("%s",sup[sumsup].xingming);581         fflush(stdin);582         {583                         printf("\t\t   ┌───────┐│\n");584                         printf("\t\t   │请输入职工号:││  \n");585                         printf("\t\t   └───────┘│");586         }587         scanf("%s",sup[sumsup].ip);588         if(search(sup[sumsup].ip)==1)589             {590             system("cls");591             printf("\n\n\n\n\n");592             printf("\t\t\t┌────────┐\n");593             printf("\t\t\t│账号已存在!!  │\n");594             printf("\t\t\t└────────┘\n");595             Sleep(1000);596             system("cls");597             continue;598             }599         else break;600     }601         fflush(stdin);602         fprintf(fp,"%s ",sup[sumsup].xingming);603         fprintf(fp,"%s ",sup[sumsup].ip);604         {605                         printf("\t\t   ┌───────┐│\n");606                         printf("\t\t   │请输入密码 : ││  \n");607                         printf("\t\t   └───────┘│");608         }609         scanf("%s",sup[sumsup].mima);610         fflush(stdin);611         fprintf(fp,"%s ",sup[sumsup].mima);612         {613                         printf("\t\t   ┌───────┐│\n");614                         printf("\t\t   │请输入性别 : ││  \n");615                         printf("\t\t   └───────┘│");616         }617         scanf("%s",sup[sumsup].xingbie);618         fflush(stdin);619         fprintf(fp,"%s ",sup[sumsup].xingbie);620         {621                         printf("\t\t   ┌───────┐│\n");622                         printf("\t\t   │请输入工资 : ││  \n");623                         printf("\t\t   └───────┘│");624         }625         scanf("%d",&sup[sumsup].gongzi);626         fflush(stdin);627         fprintf(fp,"%d ",sup[sumsup].gongzi);628         {629                          printf("\t\t   ┌───────┐│\n");630                         printf("\t\t   │请输入年龄 : ││  \n");631                         printf("\t\t   └───────┘│");632         }633         scanf("%d",&sup[sumsup].nianling);634         fflush(stdin);635         fprintf(fp,"%d ",sup[sumsup].nianling);636         sup[sumsup].zhuangtai=1;637         fflush(stdin);638         fprintf(fp,"%d\n",sup[sumsup].zhuangtai);639         sumsup++;640         Sleep(1500);641         system("cls");642         printf("\n\n\n\n\n");643         printf("\t\t  \t ┌────────┐\n");644         printf("\t\t  \t │已经录入成功!!│\n");645         printf("\t\t  \t └────────┘\n");646         Sleep(1500);647         system("cls");648     }649 }650 651 void delete1()652 {653     printf("\n\n\n");654     printf("\t\t   ┌─────────────────────┐\n");655     printf("\t\t   │删除普通用户请按1,删除管理员用户请按2!!│\n");656     printf("\t\t   └─────────────────────┘\n");657     int n;658     scanf("%d",&n);659     if(n==1)660     while(1)661     {662        printf("\t┌───────┐│\n");663        printf("\t│请输入账号!!││\n");664        printf("\t└───────┘│");665        int i;666        char  ip[60];667     scanf("%s",ip);668     fflush(stdin);669     for(i=0;i<=sum-1;i++)670     {671         if(strcmp(f[i].ip,ip)==0)672             break;673     }674     if(i==sum)675     {676         system("cls");677        printf("\t\t\t       ┌───────┐\n");678        printf("\t\t\t       │账号不存在!!│\n");679        printf("\t\t\t       └───────┘\n");680      printf("\t   ┌────────────┐  ┌────────────┐\n");681      printf("\t   │          按1:         │  │          按0:         │\n");682      printf("\t   │                        │  │                        │\n");683      printf("\t   │      重新输入账号!    │  │         退出!         │\n");684      printf("\t   │                        │  │                        │\n");685      printf("\t   └────────────┘  └────────────┘\n");686      int m;687      scanf("%d",&m);688      if(m==1)continue;689      if(m==0)exit(0);690     }691     else692     {693          Sleep(2000);694          system("cls");695          printf("\n\n\n");696          f[i].zhuangtai=0;697        printf("\t\t\t┌───────┐\n");698        printf("\t\t\t│已成功删除!!│\n");699        printf("\t\t\t└───────┘\n");700        gengxin();701        system("pause");702        system("cls");703        break;704     }705     }706     else if(n==2)707     while(1)708     {709        printf("\t┌───────┐│\n");710        printf("\t│请输入账号!!││\n");711        printf("\t└───────┘│");712        int i;713        char  ip[60];714     scanf("%s",ip);715     fflush(stdin);716     for(i=0;i<=sumsup-1;i++)717     {718         if(strcmp(sup[i].ip,ip)==0)719             break;720     }721     if(i==sum)722     {723         system("cls");724        printf("\t\t\t       ┌───────┐\n");725        printf("\t\t\t       │账号不存在!!│\n");726        printf("\t\t\t       └───────┘\n");727      printf("\t   ┌────────────┐  ┌────────────┐\n");728      printf("\t   │          按1:         │  │          按0:         │\n");729      printf("\t   │                        │  │                        │\n");730      printf("\t   │      重新输入账号!    │  │         退出!         │\n");731      printf("\t   │                        │  │                        │\n");732      printf("\t   └────────────┘  └────────────┘\n");733      int m;734      scanf("%d",&m);735      if(m==1)continue;736      if(m==0)exit(0);737     }738     else739     {740          Sleep(2000);741          system("cls");742          printf("\n\n\n");743          sup[i].zhuangtai=0;744        printf("\t\t\t┌───────┐\n");745        printf("\t\t\t│已成功删除!!│\n");746        printf("\t\t\t└───────┘\n");747        gengxin();748        system("pause");749        system("cls");750        break;751     }752     }753     else754     {755         printf("\t\t\t┌──────────────────────┐\n");756         printf("\t\t\t│您的输入不符合要求!!│\n");757         printf("\t\t\t└──────────────────────┘\n");758         delete1();759     }760 }761 void change()762 {763     system("cls");764     printf("\n\n\n\n\n");765     printf("\t\t┌───────────────────────┐\n");766     printf("\t\t│修改普通用户信息请按1,修改管理员用户请按2!!│\n");767     printf("\t\t└───────────────────────┘\n");768     int m;769     scanf("%d",&m);770     Sleep(1500);771     system("cls");772     if(m==1)773     {774         char ip[60];775         int i;776     while(1)777     {778 779        system("cls");780        printf("\t┌────────┐│\n");781        printf("\t│请输入账号:!!││\n");782        printf("\t└────────┘│");783     scanf("%s",ip);784     for(i=0;i<=sum-1;i++)785     {786         if(strcmp(f[i].ip,ip)==0)787             break;788     }789     if(i==sum)790     {791        system("cls");792        printf("\t\t\t       ┌───────┐\n");793        printf("\t\t\t       │账号不存在!!│\n");794        printf("\t\t\t       └───────┘\n");795        //system("cls");796      printf("\t   ┌────────────┐  ┌────────────┐\n");797      printf("\t   │          按1:         │  │          按0:         │\n");798      printf("\t   │                        │  │                        │\n");799      printf("\t   │     重新输入账号!     │  │         退出!         │\n");800      printf("\t   │                        │  │                        │\n");801      printf("\t   └────────────┘  └────────────┘\n");802      int m;803      scanf("%d",&m);804      fflush(stdin);805      if(m==1)806      {807          Sleep(1000);808          system("cls");809      }810     else if(m==0)exit(0);811     else {812          printf("\t\t┌───────────────┐\n");813          printf("\t\t│您的输入有误!!请重新输入!!│\n");814          printf("\t\t└───────────────┘\n");815         }816     }817     else break;818     }819     fflush(stdin);820     char g[50];821     Sleep(1000);822     system("cls");823     printf("\n\n");824     printf("\n\n\n");825    printf("\t┌───────────────────────────┐\n");826    printf("\t│您只能在姓名,密码,年龄,工资,性别五个选项中选一个! │ \n");827    printf("\t└───────────────────────────┘\n\n\n");828    system("pause");829    system("cls");830    printf("       ┌──────────────────┐│\n");831    printf("       │您想修改什么?请输入您想修改的内容! ││\n");832    printf("       └──────────────────┘│");833     scanf("%s",g);834     fflush(stdin);835         if(strcmp("姓名",g)==0)836         {837             {838                         printf("\t\t\t   ┌────────┐│\n");839                         printf("\t\t\t   │请输入新姓名 : ││  \n");840                         printf("\t\t\t   └────────┘│");841             }842             scanf("%s",g);843             fflush(stdin);844             strcpy(f[i].xingming,g);845         }846      else    if(strcmp("密码",g)==0)847         {848             char  t[60];849             {850                         printf("\t\t\t   ┌────────┐│\n");851                         printf("\t\t\t   │请输入新密码 : ││\n");852                         printf("\t\t\t   └────────┘│");853             }854             scanf("%s",t);855             fflush(stdin);856             strcpy(f[i].mima,t);857         }858       else   if(strcmp("年龄",g)==0)859         {860             int t;861             {862                         printf("\t\t\t   ┌────────┐│\n");863                         printf("\t\t\t   │请输入新年龄 : ││\n");864                         printf("\t\t\t   └────────┘│");865             }866             scanf("%d",&t);867             fflush(stdin);868             f[i].nianling=t;869 870         }871        else if(strcmp("工资",g)==0)872         {873             int t;874             {875                         printf("\t\t\t   ┌────────┐│\n");876                         printf("\t\t\t   │请输入新工资 : ││  \n");877                         printf("\t\t\t   └────────┘│");878             }879             scanf("%d",&t);880             fflush(stdin);881             f[i].gongzi=t;882 883         }884       else  if(strcmp("性别",g)==0)885         {886             {887                         printf("\t\t\t   ┌────────┐│\n");888                         printf("\t\t\t   │请输入新性别 : ││\n");889                         printf("\t\t\t   └────────┘│");890             }891             scanf("%s",g);892             fflush(stdin);893             strcpy(f[i].xingbie,g);894         }895    else896     {897        printf("\t\t\t┌────────┐\n");898        printf("\t\t\t│您的输入有误!!│\n");899        printf("\t\t\t└────────┘\n");900        system("pause");901        system("cls");902        return ;903     }904        system("cls");905        printf("\t\t┌────────────────────┐\n");906        printf("\t\t│           经过修改后的信息为:         │\n");907        printf("\t\t└────────────────────┘\n");908        printf("\t\t\t  ┌──┬──────\n");909        printf("\t\t\t  │账号│%-5s        \n",f[i].ip);910        printf("\t\t\t  ├──┼──────\n");911        printf("\t\t\t  │姓名│%-5s        \n",f[i].xingming);912        printf("\t\t\t  ├──┼──────\n");913        printf("\t\t\t  │密码│%-5s        \n",f[i].mima);914        printf("\t\t\t  ├──┼──────\n");915        printf("\t\t\t  │年龄│%-5d        \n",f[i].nianling);916        printf("\t\t\t  ├──┼──────\n");917        printf("\t\t\t  │性别│%-5s        \n",f[i].xingbie);918        printf("\t\t\t  ├──┼──────\n");919        printf("\t\t\t  │工资│%-5d        \n",f[i].gongzi);920        printf("\t\t\t  ├──┼──────                \n");921        if(f[i].zhuangtai==1)922        {923            printf("\t\t\t  │状态│在职        \n");924        printf("\t\t\t  └──┴──────\n");925        }926        else927        {928           printf("\t\t\t  │状态│不在职        \n");929           printf("\t\t\t  └──┴──────\n");930        }931        gengxin();932        system("pause");933        system("cls");934        }935     else  if(m==2)936      {937         char ip[60];938         int i;939     while(1)940     {941 942        system("cls");943        printf("\t┌────────┐│\n");944        printf("\t│请输入账号:!!││\n");945        printf("\t└────────┘│");946     scanf("%s",ip);947     for(i=0;i<=sum-1;i++)948     {949         if(strcmp(sup[i].ip,ip)==0)950             break;951     }952     if(i==sum)953     {954        system("cls");955        printf("\t\t\t       ┌───────┐\n");956        printf("\t\t\t       │账号不存在!!│\n");957        printf("\t\t\t       └───────┘\n");958        //system("cls");959      printf("\t   ┌────────────┐  ┌────────────┐\n");960      printf("\t   │          按1:         │  │          按0:         │\n");961      printf("\t   │                        │  │                        │\n");962      printf("\t   │     重新输入账号!     │  │         退出!         │\n");963      printf("\t   │                        │  │                        │\n");964      printf("\t   └────────────┘  └────────────┘\n");965      int m;966      scanf("%d",&m);967      fflush(stdin);968      if(m==1)969      {970          Sleep(1000);971          system("cls");972      }973     else if(m==0)exit(0);974     else {975          printf("\t\t┌───────────────┐\n");976          printf("\t\t│您的输入有误!!请重新输入!!│\n");977          printf("\t\t└───────────────┘\n");978         }979     }980     else break;981     }982     fflush(stdin);983     char g[50];984     Sleep(1000);985     system("cls");986     printf("\n\n");987     printf("\n\n\n");988    printf("\t┌───────────────────────────┐\n");989    printf("\t│您只能在姓名,密码,年龄,工资,性别五个选项中选一个! │ \n");990    printf("\t└───────────────────────────┘\n\n\n");991    system("pause");992    system("cls");993    printf("       ┌──────────────────┐│\n");994    printf("       │您想修改什么?请输入您想修改的内容! ││\n");995    printf("       └──────────────────┘│");996     scanf("%s",g);997     fflush(stdin);998         if(strcmp("姓名",g)==0)999         {
1000             {
1001                         printf("\t\t\t   ┌────────┐│\n");
1002                         printf("\t\t\t   │请输入新姓名 : ││  \n");
1003                         printf("\t\t\t   └────────┘│");
1004             }
1005             scanf("%s",g);
1006             fflush(stdin);
1007             strcpy(sup[i].xingming,g);
1008 
1009         }
1010      else    if(strcmp("密码",g)==0)
1011         {
1012             char  t[60];
1013             {
1014                         printf("\t\t\t   ┌────────┐│\n");
1015                         printf("\t\t\t   │请输入新密码 : ││\n");
1016                         printf("\t\t\t   └────────┘│");
1017             }
1018             scanf("%s",t);
1019             fflush(stdin);
1020             strcpy(sup[i].mima,t);
1021         }
1022       else   if(strcmp("年龄",g)==0)
1023         {
1024             int t;
1025             {
1026                         printf("\t\t\t   ┌────────┐│\n");
1027                         printf("\t\t\t   │请输入新年龄 : ││\n");
1028                         printf("\t\t\t   └────────┘│");
1029             }
1030             scanf("%d",&t);
1031             fflush(stdin);
1032             sup[i].nianling=t;
1033 
1034         }
1035        else if(strcmp("工资",g)==0)
1036         {
1037             int t;
1038             {
1039                         printf("\t\t\t   ┌────────┐│\n");
1040                         printf("\t\t\t   │请输入新工资 : ││  \n");
1041                         printf("\t\t\t   └────────┘│");
1042             }
1043             scanf("%d",&t);
1044             fflush(stdin);
1045             sup[i].gongzi=t;
1046 
1047         }
1048       else  if(strcmp("性别",g)==0)
1049         {
1050             {
1051                         printf("\t\t\t   ┌────────┐│\n");
1052                         printf("\t\t\t   │请输入新性别 : ││\n");
1053                         printf("\t\t\t   └────────┘│");
1054             }
1055             scanf("%s",g);
1056             fflush(stdin);
1057             strcpy(sup[i].xingbie,g);
1058 
1059         }
1060    else
1061     {
1062        printf("\t\t\t┌────────┐\n");
1063        printf("\t\t\t│您的输入有误!!│\n");
1064        printf("\t\t\t└────────┘\n");
1065        system("pause");
1066        system("cls");
1067        return ;
1068     }
1069        system("cls");
1070        printf("\t\t┌────────────────────┐\n");
1071        printf("\t\t│           经过修改后的信息为:         │\n");
1072        printf("\t\t└────────────────────┘\n");
1073        printf("\t\t\t  ┌──┬──────\n");
1074        printf("\t\t\t  │账号│%-5s        \n",sup[i].ip);
1075        printf("\t\t\t  ├──┼──────\n");
1076        printf("\t\t\t  │姓名│%-5s        \n",sup[i].xingming);
1077        printf("\t\t\t  ├──┼──────\n");
1078        printf("\t\t\t  │密码│%-5s        \n",sup[i].mima);
1079        printf("\t\t\t  ├──┼──────\n");
1080        printf("\t\t\t  │年龄│%-5d        \n",sup[i].nianling);
1081        printf("\t\t\t  ├──┼──────\n");
1082        printf("\t\t\t  │性别│%-5s        \n",sup[i].xingbie);
1083        printf("\t\t\t  ├──┼──────\n");
1084        printf("\t\t\t  │工资│%-5d        \n",sup[i].gongzi);
1085        printf("\t\t\t  ├──┴──────                \n");
1086        if(sup[i].zhuangtai==1)
1087        {
1088            printf("\t\t\t  │工资│在职        \n");
1089        printf("\t\t\t  └──┴──────\n");
1090        }
1091        else
1092        {
1093            printf("\t\t\t  │工资│不在职        \n");
1094        printf("\t\t\t  └──┴──────\n");
1095        }
1096        gengxin();
1097        system("pause");
1098        system("cls");
1099       }
1100        else
1101        {
1102         system("cls");
1103         printf("\n\n\n");
1104         printf("\t\t\t┌─────────────┐\n");
1105         printf("\t\t\t│您的输入有误!请重新输入!│\n");
1106         printf("\t\t\t└─────────────┘\n");
1107         Sleep(1500);
1108         system("cls");
1109         change();
1110        }
1111 }
1112 int  search(char  zhanghao[])
1113 {
1114     int i;
1115     for(i=0;i<=sum-1;i++)
1116     {
1117         if(strcmp(f[i].ip,zhanghao)==0)
1118             break;
1119     }
1120     if(i!=sum)return 1;
1121     for(i=0;i<=sumsup-1;i++)
1122     {
1123         if(strcmp(sup[i].ip,zhanghao)==0)
1124             break;
1125     }
1126     if(i==sumsup)return 0;
1127     if(i!=sumsup)return 1;
1128 }
1129 void search1()
1130 {
1131     int k=1;
1132     {
1133                         printf("\t\t   ┌───────────┐│\n");
1134                         printf("\t\t   │请输入要查询的账号 : ││  \n");
1135                         printf("\t\t   └───────────┘│");
1136     }
1137     char  zhanghao[60];
1138     scanf("%s",zhanghao);
1139     int i;
1140     for(i=0;i<=sum-1;i++)
1141     {
1142         if(strcmp(f[i].ip,zhanghao)==0)
1143        {
1144         break;
1145        }
1146     }
1147     if(i==sum)
1148     {
1149         k=0;
1150     }
1151     if(i!=sum)
1152     {
1153         k=1;
1154        printf("\t\t\t┌──┬──────\n");
1155        printf("\t\t\t│账号│%-5s        \n",f[i].ip);
1156        printf("\t\t\t├──┼──────\n");
1157        printf("\t\t\t│姓名│%-5s        \n",f[i].xingming);
1158        printf("\t\t\t├──┼──────\n");
1159        printf("\t\t\t│密码│%-5s        \n",f[i].mima);
1160        printf("\t\t\t├──┼──────\n");
1161        printf("\t\t\t│年龄│%-5d        \n",f[i].nianling);
1162        printf("\t\t\t├──┼──────\n");
1163        printf("\t\t\t│性别│%-5s        \n",f[i].xingbie);
1164        printf("\t\t\t├──┼──────\n");
1165        printf("\t\t\t│工资│%-5d        \n",f[i].gongzi);
1166        printf("\t\t\t├──┼──────\n");
1167        if(f[i].zhuangtai==1)
1168        {
1169            printf("\t\t\t│状态│在职        \n");
1170        printf("\t\t\t└──┴──────                \n");
1171        }
1172        else
1173        {
1174            printf("\t\t\t│状态│不在职        \n");
1175        printf("\t\t\t└──┴──────                \n");
1176        }
1177     }
1178     if(k==1)
1179     {
1180         system("pause");
1181         system("cls");
1182         return ;
1183     }
1184     for(i=0;i<=sumsup-1;i++)
1185     {
1186         if(strcmp(sup[i].ip,zhanghao)==0)
1187               break;
1188     }
1189     if(i!=sumsup)
1190      {
1191         k=1;
1192        printf("\t\t\t┌──┬──────\n");
1193        printf("\t\t\t│账号│%-5s        \n",sup[i].ip);
1194        printf("\t\t\t├──┼──────\n");
1195        printf("\t\t\t│姓名│%-5s        \n",sup[i].xingming);
1196        printf("\t\t\t├──┼──────\n");
1197        printf("\t\t\t│密码│%-5s        \n",sup[i].mima);
1198        printf("\t\t\t├──┼──────\n");
1199        printf("\t\t\t│年龄│%-5d        \n",sup[i].nianling);
1200        printf("\t\t\t├──┼──────\n");
1201        printf("\t\t\t│性别│%-5s        \n",sup[i].xingbie);
1202        printf("\t\t\t├──┼──────\n");
1203        printf("\t\t\t│工资│%-5d        \n",sup[i].gongzi);
1204        printf("\t\t\t├──┼──────\n");
1205        if(sup[i].zhuangtai==1)
1206        {
1207            printf("\t\t\t│状态│在职        \n");
1208        printf("\t\t\t└──┴──────                \n");
1209        }
1210        else
1211        {
1212            printf("\t\t\t│状态│不在职        \n");
1213        printf("\t\t\t└──┴──────                \n");
1214        }
1215     }
1216     if(i==sumsup)k=0;
1217     if(k==0)
1218     {
1219        system("cls");
1220        printf("\n\n\n\n");
1221        printf("\t\t\t┌────────────┐\n");
1222        printf("\t\t\t│您所查询的账号不存在!!│\n");
1223        printf("\t\t\t└────────────┘\n");
1224     }
1225     system("pause");
1226     system("cls");
1227 }
1228 void output(char ip[])
1229 {
1230     int i;
1231     for(i=0;i<=sum-1;i++)
1232     {
1233         if(strcmp(f[i].ip,ip)==0)
1234         {
1235        printf("\t\t\t┌──┬──────\n");
1236        printf("\t\t\t│账号│%-5s        \n",f[i].ip);
1237        printf("\t\t\t├──┼──────\n");
1238        printf("\t\t\t│姓名│%-5s        \n",f[i].xingming);
1239        printf("\t\t\t├──┼──────\n");
1240        printf("\t\t\t│密码│%-5s        \n",f[i].mima);
1241        printf("\t\t\t├──┼──────\n");
1242        printf("\t\t\t│年龄│%-5d        \n",f[i].nianling);
1243        printf("\t\t\t├──┼──────\n");
1244        printf("\t\t\t│性别│%-5s        \n",f[i].xingbie);
1245        printf("\t\t\t├──┼──────\n");
1246        printf("\t\t\t│工资│%-5d        \n",f[i].gongzi);
1247        printf("\t\t\t├──┼──────\n");
1248        if(f[i].zhuangtai==1)
1249        {
1250            printf("\t\t\t│状态│在职        \n");
1251        printf("\t\t\t└──┴──────                \n");
1252        }
1253        else
1254        {
1255            printf("\t\t\t│状态│不在职        \n");
1256        printf("\t\t\t└──┴──────                \n");
1257        }
1258         break;
1259       }
1260     }
1261     system("pause");
1262     system("cls");
1263 }
1264 void load()//录入成员
1265 {
1266     FILE *fp;
1267     fp=fopen("c://rizhi.txt","rb");
1268     int i;
1269     for(i=0;!feof(fp);i++)
1270     {
1271         fscanf(fp,"%s %s %s %s %d %d %d\n",f[i].xingming ,f[i].ip,f[i].mima,f[i].xingbie,&f[i].gongzi,&f[i].nianling,&f[i].zhuangtai);
1272         sum++;
1273     }
1274 }
1275 void change1(char zhanghao[])
1276 {
1277     int i;
1278     for(i=0;i<=sum-1;i++)
1279     {
1280         if(strcmp(zhanghao,f[i].ip)==0)
1281         {
1282             break;
1283         }
1284     }
1285 
1286    char g[50];
1287    Sleep(1000);
1288    system("cls");
1289    printf("\n\n");
1290    printf("\t┌───────────────────────────┐\n");
1291    printf("\t│您只能在姓名,密码,年龄,工资,性别五个选项中选一个! │ \n");
1292    printf("\t└───────────────────────────┘\n\n\n");
1293    system("pause");
1294    system("cls");
1295    printf("       ┌──────────────────┐│\n");
1296    printf("       │您想修改什么?请输入您想修改的内容! ││\n");
1297    printf("       └──────────────────┘│");
1298     scanf("%s",g);
1299     fflush(stdin);
1300         if(strcmp("姓名",g)==0)
1301         {
1302             {
1303                         printf("\t\t\t   ┌────────┐│\n");
1304                         printf("\t\t\t   │请输入新姓名 : ││  \n");
1305                         printf("\t\t\t   └────────┘│");
1306             }
1307             scanf("%s",g);
1308             fflush(stdin);
1309             strcpy(f[i].xingming,g);
1310         }
1311        else if(strcmp("密码",g)==0)
1312         {
1313             char  t[60];
1314             {
1315                         printf("\t\t\t   ┌────────┐│\n");
1316                         printf("\t\t\t   │请输入新密码 : ││  \n");
1317                         printf("\t\t\t   └────────┘│");
1318             }
1319             scanf("%s",t);
1320             fflush(stdin);
1321             strcpy(f[i].mima,t);
1322 
1323         }
1324       else   if(strcmp("年龄",g)==0)
1325         {
1326             int t;
1327             {
1328                         printf("\t\t\t   ┌────────┐│\n");
1329                         printf("\t\t\t   │请输入新年龄 : ││\n");
1330                         printf("\t\t\t   └────────┘│");
1331             }
1332             scanf("%d",&t);
1333             fflush(stdin);
1334             f[i].nianling=t;
1335 
1336         }
1337      else   if(strcmp("工资",g)==0)
1338         {
1339             int t;
1340             {
1341                         printf("\t\t\t   ┌────────┐│\n");
1342                         printf("\t\t\t   │请输入新工资 : ││  \n");
1343                         printf("\t\t\t   └────────┘│");
1344             }
1345             scanf("%d",&t);
1346             fflush(stdin);
1347             f[i].gongzi=t;
1348         }
1349      else    if(strcmp("性别",g)==0)
1350         {
1351             {
1352                         printf("\t\t\t   ┌────────┐│\n");
1353                         printf("\t\t\t   │请输入新性别 : ││  \n");
1354                         printf("\t\t\t   └────────┘│");
1355             }
1356             scanf("%s",g);
1357             fflush(stdin);
1358             strcpy(f[i].xingbie,g);
1359 
1360         }
1361     else
1362     {
1363        printf("\t\t\t┌────────┐\n");
1364        printf("\t\t\t│您的输入有误!!│\n");
1365        printf("\t\t\t└────────┘\n");
1366        system("pause");
1367        system("cls");
1368        return ;
1369     }
1370     system("cls");
1371        printf("\t\t┌────────────────────┐\n");
1372        printf("\t\t│           经过修改后的信息为:         │\n");
1373        printf("\t\t└────────────────────┘\n");
1374        printf("\t\t\t  ┌──┬──────\n");
1375        printf("\t\t\t  │账号│%-5s        \n",f[i].ip);
1376        printf("\t\t\t  ├──┼──────\n");
1377        printf("\t\t\t  │姓名│%-5s        \n",f[i].xingming);
1378        printf("\t\t\t  ├──┼──────\n");
1379        printf("\t\t\t  │密码│%-5s        \n",f[i].mima);
1380        printf("\t\t\t  ├──┼──────\n");
1381        printf("\t\t\t  │年龄│%-5d        \n",f[i].nianling);
1382        printf("\t\t\t  ├──┼──────\n");
1383        printf("\t\t\t  │性别│%-5s        \n",f[i].xingbie);
1384        printf("\t\t\t  ├──┼──────\n");
1385        printf("\t\t\t  │工资│%-5d        \n",f[i].gongzi);
1386        printf("\t\t\t  ├──┼──────                \n");
1387        if(f[i].zhuangtai==1)
1388        {
1389            printf("\t\t\t  │状态│在职        \n");
1390            printf("\t\t\t  └──┴──────                \n");
1391        }
1392        else
1393        {
1394            printf("\t\t\t  │状态│不在职        \n");
1395            printf("\t\t\t  └──┴──────                \n");
1396        }
1397        system("pause");
1398        system("cls");
1399 }
1400 int check(char ip[],char mima[])
1401 {
1402     int i;
1403     for(i=0;i<=sum-1;i++)
1404     {
1405         if(strcmp(f[i].ip,ip)==0)
1406             break;
1407     }
1408     if(i==sum)return 0;
1409     for(i=0;i<=sum-1;i++)
1410     {
1411         if(strcmp(f[i].mima,mima)==0)
1412             break;
1413     }
1414     if(i==sum)return 1;
1415     for(i=0;i<=sum-1;i++)
1416     {
1417         if(strcmp(f[i].mima,mima)==0&&strcmp(f[i].ip,ip)==0)
1418             break;
1419     }
1420     if(i!=sum)
1421     {
1422         printf("\n\n\n\t\t\t  ★★★★★★★★★★\n\n");
1423         printf("\t\t\t   欢迎您!%s\n",f[i].xingming);
1424         printf("\n\t\t\t  ★★★★★★★★★★\n");
1425         Sleep(1500);
1426         return 2;
1427     }
1428     else return 3;
1429 }
1430 void gengxin()
1431 {
1432     int i;
1433     FILE *fp;
1434     fp=fopen("c://rizhi.txt","w");
1435     for(i=0;i<=sum-1;i++)
1436     {
1437         fprintf(fp,"%s %s %s %s %d %d %d\n",f[i].xingming,f[i].ip,f[i].mima,f[i].xingbie,f[i].gongzi,f[i].nianling,f[i].zhuangtai);
1438     }
1439     fclose(fp);
1440     fp=fopen("c://rizhi1.txt","w");
1441     for(i=0;i<=sumsup-1;i++)
1442         fprintf(fp,"%s %s %s %s %d %d %d\n",sup[i].xingming,sup[i].ip,sup[i].mima,sup[i].xingbie,sup[i].gongzi,sup[i].nianling,sup[i].zhuangtai);
1443     fclose(fp);
1444 }
1445 void mohuchazhao()
1446 {
1447     int i,k=1;
1448     char g[60];
1449     printf("\t\t┌───────────┐│\n");
1450     printf("\t\t│请输入要查找的关键字: ││\n");
1451     printf("\t\t└───────────┘│");
1452     scanf("%s",g);
1453     for(i=0;i<=sum-1;i++)
1454     {
1455         if(strstr(f[i].xingming,g)!=NULL)
1456     {
1457        printf("\t\t\t┌──┬──────\n");
1458        printf("\t\t\t│账号│%-5s        \n",f[i].ip);
1459        printf("\t\t\t├──┼──────\n");
1460        printf("\t\t\t│姓名│%-5s        \n",f[i].xingming);
1461        printf("\t\t\t├──┼──────\n");
1462        printf("\t\t\t│密码│%-5s        \n",f[i].mima);
1463        printf("\t\t\t├──┼──────\n");
1464        printf("\t\t\t│年龄│%-5d        \n",f[i].nianling);
1465        printf("\t\t\t├──┼──────\n");
1466        printf("\t\t\t│性别│%-5s        \n",f[i].xingbie);
1467        printf("\t\t\t├──┼──────\n");
1468        printf("\t\t\t│工资│%-5d        \n",f[i].gongzi);
1469        printf("\t\t\t├──┼──────\n");
1470        if(f[i].zhuangtai==1)
1471        {
1472            printf("\t\t\t│状态│在职        \n");
1473        printf("\t\t\t└──┴──────                \n");
1474        }
1475        else
1476        {
1477            printf("\t\t\t│状态│不在职        \n");
1478        printf("\t\t\t└──┴──────                \n");
1479        }
1480        k=0;
1481     }
1482     else continue;
1483     }
1484      if(i==sum&&k==0)k=1;
1485     for(i=0;i<=sumsup-1;i++)
1486     {
1487         if(strstr(sup[i].xingming,g)!=NULL)
1488     {
1489        k=0;
1490        printf("\t\t\t┌──┬──────\n");
1491        printf("\t\t\t│账号│%-5s        \n",sup[i].ip);
1492        printf("\t\t\t├──┼──────\n");
1493        printf("\t\t\t│姓名│%-5s        \n",sup[i].xingming);
1494        printf("\t\t\t├──┼──────\n");
1495        printf("\t\t\t│密码│%-5s        \n",sup[i].mima);
1496        printf("\t\t\t├──┼──────\n");
1497        printf("\t\t\t│年龄│%-5d        \n",sup[i].nianling);
1498        printf("\t\t\t├──┼──────\n");
1499        printf("\t\t\t│性别│%-5s        \n",sup[i].xingbie);
1500        printf("\t\t\t├──┼──────\n");
1501        printf("\t\t\t│工资│%-5d        \n",sup[i].gongzi);
1502        printf("\t\t\t├──┼──────\n");
1503        if(sup[i].zhuangtai==1)
1504        {
1505            printf("\t\t\t│状态│在职        \n");
1506        printf("\t\t\t└──┴──────                \n");
1507        }
1508        else
1509        {
1510            printf("\t\t\t│状态│不在职        \n");
1511        printf("\t\t\t└──┴──────                \n");
1512        }
1513     }
1514     else continue;
1515     }
1516 
1517     if(i==sumsup&&k==1)
1518     {
1519         printf("您的输入有误!!\n");
1520     }
1521     system("pause");
1522     system("cls");
1523 }
1524 
1525 void loadsup()
1526 {
1527     FILE *fp=fopen("c://rizhi1.txt","r");
1528     int i;
1529     for(i=0;!feof(fp);i++)
1530     {
1531         fscanf(fp,"%s %s %s %s %d %d %d\n",sup[i].xingming,sup[i].ip,sup[i].mima,sup[i].xingbie,&sup[i].gongzi,&sup[i].nianling,&sup[i].zhuangtai);
1532         sumsup++;
1533     }
1534     fclose(fp);
1535 }
1536 int checksup(char ip[],char mima[])
1537 {
1538     int i;
1539     for(i=0;i<=sum-1;i++)
1540     {
1541         if(strcmp(sup[i].ip,ip)==0)
1542             break;
1543     }
1544     if(i==sum)return 0;
1545     for(i=0;i<=sum-1;i++)
1546     {
1547         if(strcmp(sup[i].mima,mima)==0)
1548             break;
1549     }
1550     if(i==sum)return 1;
1551     for(i=0;i<=sum-1;i++)
1552     {
1553         if(strcmp(sup[i].mima,mima)==0&&strcmp(sup[i].ip,ip)==0)
1554             break;
1555     }
1556     if(i!=sum)
1557     {
1558         printf("\n\n\n\t\t\t  ★★★★★★★★★★\n\n");
1559         printf("\t\t\t   欢迎您!%s\n",sup[i].xingming);
1560         printf("\n\t\t\t  ★★★★★★★★★★\n");
1561         Sleep(1500);
1562         return 2;
1563     }
1564     else return 3;
1565 }

View Code

 

转载于:https://www.cnblogs.com/kuangdaoyizhimei/p/3198690.html

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注