Skip to content

Commit d47b0e2

Browse files
committed
added Serach the book by Author name or Book name
1 parent 925980d commit d47b0e2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Project-File/Library-Management-System.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ int searchBook(int);
4242
void deleteBook(void);
4343

4444
// Main Function
45-
int main(){
46-
45+
void main(){
4746
password();
48-
return 0;
4947
}
5048

5149
// System Functions
@@ -65,6 +63,10 @@ void password(){
6563
int i = 0;
6664
char ch;
6765

66+
printf("--------------------\n");
67+
printf(">>> Login First <<<\n");
68+
printf("--------------------\n\n");
69+
6870
printf("Enter your password. Hit ENTER to confirm. \n");
6971
printf("Password:");
7072

@@ -119,7 +121,9 @@ void menu(){
119121

120122
int number;
121123

124+
printf("----------------------------------\n");
122125
printf(">>> Library Management System <<< \n");
126+
printf("----------------------------------\n\n");
123127
printf("> 1. User Management Panel \n");
124128
printf("> 2. Book Management Panel \n\n");
125129
printf("> Enter the number & hit ENTER: ");
@@ -150,7 +154,9 @@ void userPanel(){
150154

151155
int number;
152156

157+
printf("-----------------------------------------------\n");
153158
printf(">>> Library Management System - User Panel <<< \n");
159+
printf("-----------------------------------------------\n\n");
154160
printf("> 1. Add User \n");
155161
printf("> 2. Modify User \n");
156162
printf("> 3. List User \n");
@@ -206,7 +212,9 @@ void bookPanel(){
206212

207213
int number;
208214

215+
printf("-----------------------------------------------\n");
209216
printf(">>> Library Management System - Book Panel <<< \n");
217+
printf("-----------------------------------------------\n\n");
210218
printf("> 1. Add Book \n");
211219
printf("> 2. Modify Book \n");
212220
printf("> 3. List Book \n");
@@ -495,7 +503,7 @@ int searchUser(int nameSearcher){
495503
int compare;
496504
char find[255];
497505

498-
(nameSearcher != 3) ? printf("Enter the name of the person you want to see the detail: ") : printf("Enter the name of the student who wants to rent book: ");
506+
(nameSearcher != 3) ? printf("Search by First name of the student: ") : printf("Search by First name of the student who wants to rent book: ");
499507
gets(find);
500508

501509
FILE *pF = fopen("user_Records.txt", "r");
@@ -1001,14 +1009,15 @@ int searchBook(int bookSearcher){
10011009

10021010
char find[255];
10031011

1004-
(bookSearcher != 3) ? printf("Enter the name of the book you want to see the detail: ") : printf("Enter the name of the book you want: ");
1012+
(bookSearcher != 3) ? printf("Serach the book by Author name or Book name: ") : printf("Serach the book by Author name or Book name: ");
10051013
gets(find);
10061014

10071015
FILE *pF = fopen("book_Records.txt", "r");
10081016

10091017
while(fscanf(pF, "%s %s %s %lf %lf \n", name, author, publisher, &bookid, &quantity) != EOF)
10101018
{
10111019
compare = strcmp(find, name);
1020+
compare = strcmp(find, author);
10121021

10131022
if(compare == 0)
10141023
{

0 commit comments

Comments
 (0)