C language library lending system source code

  • 2020-06-03 07:36:04
  • OfStack

This paper shares the specific code of C language book lending system for your reference. The specific content is as follows


#include "stdafx.h"

#include"stdio.h"
#include"conio.h"
#include"string.h"
#include"stdlib.h"
int N;
char mima[20]="mm";
/********** Defines the book structure type book*******/
struct book
{
  long num;
  char name[20];
  char publish[20];/* Press. */
  struct time
  {
    int day;
    int month;
    int year;
  }t;
  int jie;/* borrowing */
}bk[20];
/******** Set up a library ********/
void xinxi()
{
  int i;
  system("CLS");
  printf("\t\t     =====================    \n");
  printf("\t\t         Input book information        \n");
  printf("\t\t     =====================    \n\n");
 printf("\t\t Please enter the amount you want to enter :");
 scanf("%d",&N);
  for(i=0;i<N;i++)
  {
 printf("\t\t Please enter the first %d Number of the book :",i+1);
    scanf("%d",&bk[i].num);
    printf("\t\t Please enter the first %d The title of the book :",i+1);
    scanf("%s",bk[i].name);
    printf("\t\t Please enter the first %d The publisher of this book :",i+1);
    scanf("%s",bk[i].publish);
    printf("\t\t Please enter the first %d The publication date of the book ( Set off with commas ):",i+1);
    scanf("%d,%d,%d",&bk[i].t.year,&bk[i].t.month,&bk[i].t.day);
    printf("\t\t Has the book been checked out , Has been borrowed and entered '1' , not borrowed and entered '0':");
    scanf("%d",&bk[i].jie);
 printf("--------------------------------------------------------------------------------\n");
  }
 system("CLS");
  printf("\t\t     =====================    \n");
  printf("\t\t         Information entry completed        \n");
  printf("\t\t     =====================    \n");
  printf("\n\t\t        Press any key to continue ...\n");
}
/****** The main menu ******/
int mymainmenu()
{
  int x;
 printf("\n\n\n\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\t\t|                     |\n");
  printf("\t\t|    ======================    |\n");
  printf("\t\t|       Welcome to the library management system      |\n");
  printf("\t\t|    ======================    |\n");
  printf("\t\t|                     |\n");
  printf("\t\t|      1. Administrator mode           |\n");
  printf("\t\t|      2. The customer model            |\n");
  printf("\t\t|      3. Log out            |\n");
  printf("\t\t|--------------------------------------------------------------|\n");
  printf("\n\t\t Please enter your choice :");
  scanf("%d",&x);
  return x;
}
/************** Administrator password verification *****************/
int mimayanzheng()
{
 char temp_mima[20];/* Used to store passwords entered by the user */
  printf("\n");
  printf("\t\t     ======================    \n");
  printf("\t\t       Welcome to administrator mode       \n");
  printf("\t\t     ======================    \n");
  printf("\n");
  printf("\t\t      Please enter your password :");
  scanf("%s",temp_mima);
 if(strcmp(temp_mima,mima)==0)/* Compare the password */
 return 1;
 else
 return 0;
}
/************** Change the password ***********/
void xiugaimima()
{
 char temp_mima[20],temp1[20],temp2[20];/* temp_mima[20] Used to store passwords entered by users, temp1[20],temp2[
20] It is used to store two password changes entered by the user */  
printf("\n");
  printf("\t\t     ======================    \n");
  printf("\t\t          Change the password          \n");
  printf("\t\t     ======================    \n");
  printf("\n");
 printf("\t\t       Please enter the original password :");
 scanf("\t\t%s",temp_mima);
  while(1)
  {
 if(strcmp(temp_mima,mima)==0)/* Compare the password */
 {
 printf("\t Please enter a new password :");
 scanf("%s",temp1);
 printf("\t Please input again 1 time :");
 scanf("%s",temp2);
 if(strcmp(temp1,temp2)==0)/* If you enter the same password twice */
 {
  printf("\t Password changed successfully !! Please remember the password , Any key return ...");
  strcpy(mima,temp1);
  getch();break;
 }
 else
 {
  printf("\t Enter two different passwords, failed to modify ! Any key return ...");
  getch();
  break;
 }
 }
 else
 {
 printf("\t Password mistake ! You cannot change the password ! Any key return ...");
 getch();
 break;
 }
}
} 
/************** Administrator mode ****************/
int adm()
{
  int x;
 printf("\n\n\n\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\t\t|                     |\n");
  printf("\t\t|    ======================    |\n");
  printf("\t\t|         Administrator mode         |\n");
  printf("\t\t|    ======================    |\n");
  printf("\t\t|                     |\n");
  printf("\t\t|      1. Input book information         |\n");
  printf("\t\t|      2. View book information         |\n");
  printf("\t\t|      3. Modify book information         |\n");
  printf("\t\t|      4. Change administrative password         |\n");
  printf("\t\t|      5. Log out           |\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\n\t\t Please enter your choice :");
  scanf("%d",&x);
  return x;
}
/****************** The customer model ********************/
int peo()
{
  int x;
 printf("\n\n\n\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\t\t|                     |\n");
  printf("\t\t|    ======================    |\n");
  printf("\t\t|         welcome          |\n");
  printf("\t\t|    ======================    |\n");
  printf("\t\t|                     |\n");
  printf("\t\t|      1. View book information         |\n");
  printf("\t\t|      2. Borrow books           |\n");
  printf("\t\t|      3. Log out           |\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\n\t\t Please enter your choice :");
  scanf("%d",&x);
  return x;
}
/********* View all books *******/
void show_all_book()
{
 int i;
 if(bk[0].num==0&&bk[0].t.year==0||N==0)/* when bk[0].num . bk[0].t.year When the structural array equivalent is equal to zero at the same time, there is no book information */
 printf("\t Data does not exist, please enter data first !\n\t\t Press any key to return ...");
 else
 {
 printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
 for(i=0;i<N;i++)
 {
  printf("\t%-7d %-8s %-12s  %4d years %2d month %2d day  ",bk[i].num,bk[i].name,bk[i].publish,bk[i].t.year,bk[i].t.month,bk[i].t.day);
  if(bk[i].jie==0)
  printf(" Not to borrow \n");
  else
  printf(" Have to borrow \n");
 }
 }
}
/********* View by Title ********/
void showbook_name()
{
  int i,k=0,n;/*k Used to mark the existence of the book */
  char book_name[20];
  printf("\t\t     =====================    \n");
  printf("\t\t         View by Title         \n");
  printf("\t\t     =====================    \n");
  printf("\n\t\t Please enter the name of the book you want to view :");
  scanf("%s",book_name);
  for(i=0;i<N;i++)
    if(strcmp(book_name,bk[i].name)==0)
 {
  n=i;
  if(k==0)/* " project " Only the output 1 time */
    printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
      printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[n].num,bk[n].name,bk[n].publish,bk[n].t.year,bk[n].t.month,bk[n].t.day);
   if(bk[n].jie==1)
        printf(" Have been borrowing \n");
      else
        printf(" You can borrow \n");
       printf(" Press any key to return ...");
  k++; /*k A value other than zero indicates that the book was found */
 }
 if(k==0) /*k A value of zero indicates that no book was found */
  printf("\t There is no book ! Press any key to return ...");
}
/********* Click on the isbn to view ********/
void showbook_num()
{
  int n,book_num,i,k=0;/*k Used to mark the existence of the book */
  printf("\t\t     =====================    \n");
  printf("\t\t         Click on the isbn to view         \n");
  printf("\t\t     =====================    \n");
  printf("\n\t\t Please enter the book number you want to view :");
  scanf("%d",&book_num);
  for(i=0;i<N;i++)
    if(book_num==bk[i].num)
 {
  n=i;
  if(k==0)/* Project output only 1 time */
    printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
      printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[n].num,bk[n].name,bk[n].publish,bk[n].t.year,bk[n].t.month,bk[n].t.day);
   if(bk[n].jie==1)
        printf(" Have been borrowing \n");
      else
        printf(" You can borrow \n");
  k++;
  printf("\t Press any key to return ...");
 }
 if(k==0) /*k A value of zero indicates that no books were found */
 printf("\t There is no book ! Press any key to return ...");   
}

/******** Display all books borrowed **********/
void yijieyue()
{
  int i,k=0;
 if(bk[0].num==0&&bk[0].t.year==0||N==0)
  printf("\t Data does not exist, please enter data first !\n\t\t Press any key to return ...");
 else
 {
   for(i=0;i<N;i++)
  if(bk[i].jie==1)
  {
  if(k==0)
    printf("\t Serial number    The name of the book     Press.      Publication date    \n");
  printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  \n",bk[i].num,bk[i].name,bk[i].publish,bk[i].t.year,bk[i].t.month,bk[i].t.day);
        k++;  
  }
      if(k==0)
  printf("\n\t\t There are no books out at present. Press any key to continue ...");
 }
}
/******** Displays all unborrowed books ********/
void weijieyue()
{
  int i,k=0;
 if(bk[0].num==0&&bk[0].t.year==0||N==0)
  printf("\t Data does not exist, please enter data first !\n\t\t Press any key to return ...");
 else
 {
   for(i=0;i<N;i++)
  if(bk[i].jie==0)
  {
  if(k==0)
    printf("\t Serial number    The name of the book     Press.      Publication date    \n");
  printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  \n",bk[i].num,bk[i].name,bk[i].publish,bk[i].t.year,bk[i].t.month,bk[i].t.day);
    k++;
  }
  if(k==0)
        printf("\n\t I regret! All the books are out at present. Press any key to continue ...");
 }
}
/***** View the Book Menu ******/
void show()
{
  int x;
 do
 {
  system("cls");
  printf("\n\n\n\n");
   printf("\t\t|-------------------------------------------------------------|\n");
   printf("\t\t|                     |\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|        View book information         |\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|                     |\n");
   printf("\t\t|      1. Search by title          |\n");
   printf("\t\t|      2. Press the isbn to find it          |\n");
   printf("\t\t|      3. Check out all unborrowed books      |\n");
   printf("\t\t|      4. Check out all borrowed books      |\n");
   printf("\t\t|      5. View all books         |\n");
   printf("\t\t|      6. Back to the main menu          |\n");
   printf("\t\t|-------------------------------------------------------------|\n");
   printf("\n\t\t Please enter your choice :");
   scanf("%d",&x);
   switch(x)
   {
      case 1:system("cls");showbook_name();getch();break;/* View by Title */
     case 2:system("cls");showbook_num();getch();break;/* Click on the isbn to view */
       case 3:system("cls");weijieyue();getch();break;/* Check out unborrowed books */
       case 4:system("cls");yijieyue();getch();break;/* Check out borrowed books */
   case 5:system("cls");show_all_book();getch();break;/* View all books */ 
   }                  
 }while(x!=6);
}
/********* Borrow by title *******/
void jie_name()
{
 char jy[2],name[20];/*jy Used to indicate whether you are sure to borrow */
 int i,book_xb,k=0;/*k Used to mark the existence of the book */
 printf("\t\t     ======================    \n");
  printf("\t\t         Borrow by title         \n");
  printf("\t\t     ======================    \n");
 while(1)
 {
  printf("\n\t\t Please enter the title of the book :");
  scanf("%s",name);
  for(i=0;i<N;i++)
    if(strcmp(bk[i].name,name)==0&&bk[i].jie!=1)/* Locate the book and make sure it is not checked out. Record the book subscript */
 {
   book_xb=i;
  k++;
 }
 if(k==0)
 {
 printf("\t The book does not exist or is in loan ! Please enter the name of the book correctly !\n\t\t Press any key to return ...");
 getch();
    break;
 }
 if(k==1)
   printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
  printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[book_xb].num,bk[book_xb].name,bk[book_xb].publish,bk[book_xb].t.year,bk[book_xb].t.month,bk[book_xb].t.day);
  if(bk[book_xb].jie==1)
    printf(" Have been borrowing \n");
  else
    {
      printf(" You can borrow \n\t Is it available? ( Is this: 'y' , no: 'n') : ");
      scanf("%s",jy);
      if(strcmp(jy,"n")==0)
      {
        printf("\t Borrow cancel, press any key to return ....");
        getch();
        break;
      }
      else if(strcmp(jy,"y")==0)
      {
        printf("\t Borrowed successfully! Press any key to return ...");
  bk[book_xb].jie=1;
        getch();
        break;
      }
      else
      {
        printf("\t Wrong input! Press any key to retype ...");
  getch();
        break;
      }      
 }
 }
}
/********* Borrow by the book number *******/
void jie_num()
{
 long i,k=0,book_xb,book_num;/*k Used to mark the existence of the book */
 char jy[2];/*jy Used to indicate whether you are sure to borrow */
 printf("\t\t     ======================    \n");
  printf("\t\t         Borrow by the book number         \n");
  printf("\t\t     ======================    \n");
  while(1)
 {
  printf("\n\t\t Please enter the isbn :");
  scanf("%d",&book_num);
  for(i=0;i<N;i++)
    if(bk[i].num==book_num&&bk[i].jie!=1)
 {
  book_xb=i;
  k++;
 }
    if(k==0)
 {
  printf("\t The book does not exist or is in loan ! Please enter the name of the book correctly !\n\t\t Press any key to return ...");
  getch();
      break;
 }
 printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
  printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[book_xb].num,bk[book_xb].name,bk[book_xb].publish,bk[book_xb].t.year,bk[book_xb].t.month,bk[book_xb].t.day);
  if(bk[book_xb].jie==1)
    printf(" Have been borrowing \n");
  else
  {
    printf(" You can borrow \n\t Is it available? ( Is this: 'y' , no: 'n') : ");
    scanf("%s",jy);
    if(strcmp(jy,"n")==0)
    {
       printf("\t Borrow cancel, press any key to return ....");
       getch();
       break;
    }
    else if(strcmp(jy,"y")==0)
    {
       printf("\t Borrowed successfully! Press any key to return ...");
       bk[book_xb].jie=1;
       getch();
       break;
    }
    else
    {
       printf("\t Wrong input! Press any key to retype ...");
  getch();
       break;
    }    
  }
 }
}
/********* Borrow books ********/
void jieyue()
{
  int x;
  do
  {
  system("cls");
 printf("\n\n\n\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\t\t|     =====================    |\n");
  printf("\t\t|         Borrow books          |\n");
  printf("\t\t|     =====================    |\n");
  printf("\t\t|                     |\n");
  printf("\t\t|      1. Borrow by title          |\n");
  printf("\t\t|      2. Borrow by the book number          |\n");
  printf("\t\t|      3. View all books         |\n");
  printf("\t\t|      4. Back to the main menu          |\n");
  printf("\t\t|-------------------------------------------------------------|\n");
  printf("\t\t Please enter your choice :");
  scanf("%d",&x);
  switch(x)
  {
    case 1:system("CLS");jie_name();getch();break;/* Borrow by title */
    case 2:system("CLS");jie_num();getch();break;/* Borrow by the book number */
 case 3:system("cls");show_all_book();getch();break;/* View all books */
  }
  }while(x!=4);
}
/*************** Find and modify information by title *************/
void xiugai_name()
{
 int i,book_xb,k=0;/*book_xb It's used to record the index ,k To determine if you've found the book */
 char temp[20];/*temp[20] The title used to hold the lookup entered by the user */
 while(1)
 {
 system("cls");
 printf("\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|        Revise by title        |\n");
   printf("\t\t|     =====================    |\n");
 printf("\t\t Please enter the name of the book you intend to modify , The input 'exit' exit :");
   scanf("%s",temp);
 if(strcmp(temp,"exit")==0)
 break;
 else
 {
  for(i=0;i<N;i++)
   if(strcmp(temp,bk[i].name)==0)
  {
  book_xb=i;
    printf("\t The book's message is :\n");
    printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
        printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[book_xb].num,bk[book_xb].name,bk[book_xb].publish,bk[book_xb].t.year,bk[book_xb].t.month,bk[book_xb].t.day);
  if(bk[book_xb].jie==1)
          printf(" Have been borrowing \n");
        else
          printf(" You can borrow \n");
  k++;
  printf("\t\t Now enter the new information :\n");
  printf("\t\t Please enter the number of this book :");
        scanf("%d",&bk[book_xb].num);
        printf("\t\t Please enter the name of the book :");
        scanf("%s",bk[book_xb].name);
        printf("\t\t Please enter the publisher of this book :");
        scanf("%s",bk[book_xb].publish);
        printf("\t\t Please enter a publication date for this book ( Set off with commas ):");
        scanf("%d,%d,%d",&bk[book_xb].t.year,&bk[book_xb].t.month,&bk[book_xb].t.day);
        printf("\t\t Has the book been checked out , Has been borrowed and entered '1' , not borrowed and entered '0':");
        scanf("%d",&bk[book_xb].jie);
      }
  if(k==0)
  {
  printf("\t The title you typed does not exist ! Press any key to continue ...");
  getch();
  continue;
  }
  printf("\t congratulations ! Information modified successfully ! Any key return ...");getch();break;
 }
 }
}
/*************** Press the ISbn to find and modify the information *************/
void xiugai_num()
{
 int i,book_xb,k=0;/*book_xb It's used to record the index ,k To determine if you've found the book */
 long temp;/*temp The isbn used to hold the lookup entered by the user */
 do
 {
 system("cls");
 printf("\n");
  printf("\t\t|     =====================    |\n");
  printf("\t\t|        Modify according to isbn        |\n");
  printf("\t\t|     =====================    |\n");
 printf("\t\t Please enter the book number of the book you intend to modify , The input '0' exit :");
  scanf("%ld",&temp);
 if(temp==0) break;
 else
 {
 for(i=0;i<N;i++)
   if(temp==bk[i].num)
  {
  book_xb=i;
    printf("\t The book's message is :\n");
    printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
        printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[book_xb].num,bk[book_xb].name,bk[book_xb].publish,bk[book_xb].t.year,bk[book_xb].t.month,bk[book_xb].t.day);
  k++;
  if(bk[book_xb].jie==1)
          printf(" Have been borrowing \n");
        else
          printf(" You can borrow \n");
  printf(" Now enter the new information :\n");
  printf("\t\t Please enter the number of this book :");
        scanf("%d",&bk[book_xb].num);
        printf("\t\t Please enter the name of the book :");
        scanf("%s",bk[book_xb].name);
        printf("\t\t Please enter the publisher of this book :");
        scanf("%s",bk[book_xb].publish);
        printf("\t\t Please enter a publication date for this book ( Set off with commas ):");
        scanf("%d,%d,%d",&bk[book_xb].t.year,&bk[book_xb].t.month,&bk[book_xb].t.day);
        printf("\t\t Has the book been checked out , Has been borrowed and entered '1' , not borrowed and entered '0':");
        scanf("%d",&bk[book_xb].jie);
      }
  if(k==0)
  {
  printf("\t The title you typed does not exist ! Press any key to continue ...");
  getch();continue;
  }
  printf("\t congratulations ! Information modified successfully ! Any key return ...");getch();break;
 }
 }while(temp!=0);
}
/************** Delete all books ***********/
void dele_all()
{
 char queren[4];
 printf("\t Continuing the operation deletes all information, whether to continue or not ?'y' To continue, 'n' undo ...");
 scanf("%s",queren);
 if(strcmp(queren,"y")==0)
 {
 N=0;
 printf("\t Delete the success !\n");
 }
 else
 {
 printf("\t The operation was canceled by the user ! Any key return ...");
 getch();
 }
}
/****************** Delete by title ************/
void dele_name()
{
 int i,book_xb,k=0;/*book_xb Used to store book subscripts, k Mark if the book is found */
 char queren[4],temp_name[20];/*queren[2] Used to store ' Whether or not ' Confirm the deletion ,temp_name[20] Used to store the name of the book entered during lookup */
 printf("\t Enter the name of the book you want to delete , The input '0' exit :");
 scanf("%s",temp_name);
 if(strcmp(temp_name,"0")!=0)
 {
 for(i=0;i<N;i++)
  if(strcmp(temp_name,bk[i].name)==0)
  {
  book_xb=i;
  printf("\t The book's message is :\n");
  printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
      printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[book_xb].num,bk[book_xb].name,bk[book_xb].publish,bk[book_xb].t.year,bk[book_xb].t.month,bk[book_xb].t.day);
   if(bk[i].jie==0)
  printf(" Not to borrow \n");
  else
  printf(" Have to borrow \n");
  k++;
  printf("\t Whether to delete the book ? is 'y', no 'n'");
  scanf("%s",queren);
  if(strcmp(queren,"y")==0)
  {
  if(book_xb==N-1)
   N--;
  else
  {
   for(i=0;i<N;i++)
      bk[book_xb+i]=bk[book_xb+i+1];
   N--;
  }
     printf("\t Delete the success !\n");
     }
     else
     printf("\t The operation was canceled by the user ! Any key return ...");
   }
   if(k==0)
     printf("\t No book found , Please check and operate later !, Press any key to return ....");getch();
  } 
}
/*************** Press the isbn to find and delete ***********/
void dele_num()
{
 int i,book_xb,k=0,temp_num;/*book_xb Used to store book subscripts, k Mark if the book is found ,temp_num Used to store the name of the book entered during lookup */
 char queren[4];/*queren[2] Used to store ' Whether or not ' Confirm the deletion */
 while(1)
 {
 printf("\t Enter the isbn of the book you want to delete , The input '0' exit :");
 scanf("%d",&temp_num);
 if(temp_num==0)
 break;
 else
 {
 for(i=0;i<N;i++)
  if(temp_num==bk[i].num)
  {
  book_xb=i;
  printf(" The book's message is :\n");
  printf("\t Serial number    The name of the book     Press.      Publication date     state \n");
      printf("\t%-7d %-8s %12s  %4d years %2d month %2d day  ",bk[book_xb].num,bk[book_xb].name,bk[book_xb].publish,bk[book_xb].t.year,bk[book_xb].t.month,bk[book_xb].t.day);
   if(bk[i].jie==0)
  printf(" Not to borrow \n");
  else
  printf(" Have to borrow \n");
  k++;
  printf("\t Whether to delete the book ? is 'y', no 'n'");
  scanf("%s",queren);
  if(strcmp(queren,"y")==0)
  {
  if(book_xb==N-1)
   N--;
  else
  {
   for(i=0;i<N;i++)
      bk[book_xb+i]=bk[book_xb+i+1];
   N--;
  }
     printf("\t Delete the success !\n");
     }
     else
     printf("\t The operation was canceled by the user ! Any key return ...");
      }
     if(k==0)
     printf("\t No book found , Please check and operate later !, Press any key to return ....");getch();break;
    } 
 }
}
void dele()
{
 int x; 
 do
 {
 system("cls");
 printf("\t\t|-------------------------------------------------------------|\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|        Delete book information         |\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|                     |\n");
   printf("\t\t|      1. Delete by title          |\n");
   printf("\t\t|      2. Press isbn to delete          |\n");
   printf("\t\t|      3. Delete all books         |\n");
   printf("\t\t|      4. Back to the main menu          |\n");
   printf("\t\t|-------------------------------------------------------------|\n");
 printf("\t\t Please enter your options: ");
 scanf("%d",&x);
 switch(x)
 {
  case 1:system("cls");dele_name();break;
  case 2:system("cls");dele_num();break;
  case 3:system("cls");dele_all();getch();break;
 }
 }while(x!=4);
}

/*************** Modify the books **************/
void xiugai()
{
  int x;
  do
  {
 system("cls");
 printf("\n\n\n\n");
   printf("\t\t|-------------------------------------------------------------|\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|         Modify book information        |\n");
   printf("\t\t|     =====================    |\n");
   printf("\t\t|                     |\n");
   printf("\t\t|      1. Search by title          |\n");
   printf("\t\t|      2. Press the isbn to find it          |\n");
   printf("\t\t|      3. Delete books           |\n");
   printf("\t\t|      4. Back to the main menu          |\n");
   printf("\t\t|-------------------------------------------------------------|\n");
   printf("\t\t Please enter your choice :");
   scanf("%d",&x);
   switch(x)
   {
     case 1:system("CLS");xiugai_name();break;/* Find name modification information by title */
     case 2:system("CLS");xiugai_num();break;/* Press the isbn to find and modify the information */
  case 3:system("cls");dele();break;    
   }
  }while(x!=4);
}

/************** The main function **************/       
void main()
{
  int x,x2,s;/*s Used to determine the result of password authentication */
  do
  {
    system("cls"); x=mymainmenu();
    switch(x)
    {
      case 1:/************ Call the administrator mode function ***********/
    system("cls");
          s=mimayanzheng();/* Password authentication */
    do
    {    
   if(s==1)
   {
    system("cls");
    x2=adm();
    switch(x2)
    {
    case 1:system("cls");xinxi();getch();break;/* Input information */
    case 2:system("cls");show();break;/* Check the information */        
    case 3:system("cls");xiugai();break;/* Modify the information */
    case 4:system("cls");xiugaimima();break;/* Change the password */
    } 
   }
   else
   {
    printf("\t Password error! Press any key to return ...");
    getch();
    break;
   }
    }while(x2!=5);break;
      case 2:/* Call the client mode function */
   do
   {
    system("cls");
    x2=peo();
    switch(x2)
    {
    case 1:system("cls");show();getch();break;/* View book information */
    case 2:system("cls");jieyue();getch();break;/* Borrow books */
    }    
   }while(x2!=3);
    }
  }while(x!=3);
 system("cls");
 printf("\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t Thanks for using! \n\t\t\t");
 getch();
}


Related articles: