Home > Back-end >  Great god help me, will be reported next week, but still some mistakes
Great god help me, will be reported next week, but still some mistakes

Time:09-17

# include
# include//you can call the system function library
# include

//book information structure
Struct book1
{
Char isbn [20].//ISBN
Char name [20].//title
Char author [20].//the author
Char print [20].//press
Char zone [15].//number
Int amount;//inventory
Float price;//price
};
Struct the book
{
Struct book1 book1.//book information structure
Struct book * next;
};

Void menu ();//main menu
Void menu1 ();//manager menu
Void menu2 ();//the user menu
Void backmenu1 ();//implementation returns managers function menu function
Void backmenu2 ();//user functionality menu function
Void the add ();//add
Void the display ();//show
Void change ();//modify
Void the enter ();//data entry
Void the find ();//find
Void the delete ();//delete
Void browser ();//browse
Void the insert ();//insert
Void the sort ();//order
Void lendbook ();//borrowing
Void returnbook ();//return the book
Struct book * read ();//file data into the list
Void the write (struct book * head);//the list data written to the file

Int main ()
{
Char c;
System (" color 0 a ");
menu();
Printf (" administrator please enter m, users please enter n, exit, please press 0 \ n ");
The scanf (" % c ", & amp; C);
While (c!='0')//when the output is not out of keys
{
If (c=='m')
{
Backmenu1 ();//into the management function
break;
}
The else
If (c=='n')
{
Backmenu2 ();//enter user functionality
break;
}
The else
{
Printf (" input error, please input again! \n");
The scanf (" % c ", & amp; C);
}
The scanf (" % c ", & amp; C);
}
If (c=='0')
Printf (" you have successfully quit the books management system management system! \n");
return 0;
}
//login interface
Void menu ()
{
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- books management system management system -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
Printf (" * * login options \ n ");
Printf (" * * 1. Administrators 2. Users \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
printf("\n");
}
//administrator interface
Void menu1 ()
{

Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- books management system management system -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
Printf (" * * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the administrator features list -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- * \ n ");
Printf (" * * \ n ");
Printf (" * 1. Entry book 2. Increase the book 3. Display books * \ n ");
Printf (" * 4. Modify the books information 5. Find book 6. Delete books * \ n ");
Printf (" * 7. 8. Browse books books sorting 9. Insert the book * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
printf("\n");
}
//the user interface
Void menu2 ()
{
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * books management system management system * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" * * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the user features list -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
Printf (" * * \ n ");
Printf (" * 1. Borrowing books 2. Query book 3. Return the books * \ n ");
Printf (" * 4. Browse books * \ n ");
Printf (" * -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - * \ n ");
printf("\n");
}
//implementation returns managers function menu function
Void backmenu1 ()
{
The FILE * fp.
Int n=1;
While (n!=0)
{
Menu1 ();//in this cycle, and each performs a function will continue to display the menu after
Printf (" please select the above function from the system, please press 0 \ n ");
printf("\n");
The scanf (" % d ", & amp; n);
Fp=fopen (" libraries. TXT ", "r");
If ((n>=3 & amp; & n<=9) & amp; & (fp==NULL | | fgetc (fp)==(EOF))//when no file or the file content blank and select the display) function is added to (entry
{
Printf (" no books, it is suggested that the administrator to input information books \ n ");
System (" CLS ");
}
The else
{
The switch (n)
{
Case 1: enter (); break;
Case 2: add (); break;
Case 3: the display (); break;
Case 4: change (); break;
Case 5: the find (); break;
Case 6: the delete (); break;
Case 7: browser (); break;
Case 8: sort (); break;
Case 9: insert (); break;
}
}
The fclose (fp);
}
printf("\n");
If (n==0)
Printf (" you have successfully quit the books management system management system! \n");
}

//user functionality menu function
Void backmenu2 ()
{
The FILE * fp.
Int n=1;
While (n!=0)
{
Menu2 ();
Printf (" option, exit, please press 0 \ n ");
The scanf (" % d ", & amp; n);
Fp=fopen (" libraries. TXT ", "r");
If ((fp==NULL | | fgetc (fp)==(EOF))//when no file or the file content blank
Printf (" no books in the library, oh, please wait patiently for a \ n ");
The else
{
The switch (n)
{
Case 1: lendbook (); break;
Case 2: the find (); break;
Case 3: returnbook (); break;
Case 4: browser (); break;
}
}
The fclose (fp);
}
If (n==0)
Printf (" you have successfully quit the books management system management system \ n ");
}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related