Define a structure to store the record of library. The
record must consist of at least following fields: Title,
Author, Edition, Price, Publisher, and Category.
-Define functions authorSearch ( ), TitleSearch ( ) and
CategorySearch ( ) to search a book with respect to author,
title and category. [There can be more than one book,
written by one author, in one category]

Answer Posted / student

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

struct library
{
char title[30];
char author[30];
char edition[30];
char price[30];
char publisher[30];
char category[30];
};

void titlesearch();
void authorsearch();
void categorysearch();

struct library batch[50];

void main()
{
clrscr();
for(int a=0; a<2; a++)
{
puts("Enter title of the book: ");
gets(batch[a].title);

puts("Enter author name: ");
gets(batch[a].author);

puts("Enter edition: ");
gets(batch[a].edition);

puts("Enter price: ");
gets(batch[a].price);

puts("Enter publisher: ");
gets(batch[a].publisher);

puts("Enter category: ");
gets(batch[a].category);
}
titlesearch();
authorsearch();
categorysearch();

for(a=0; a<2; a++)
{
puts(batch[a].title);
puts(batch[a].author);
puts(batch[a].edition);
puts(batch[a].price);
puts(batch[a].publisher);
puts(batch[a].category);
}
getch();
}

void titlesearch()
{ int a;
puts("Enter the title of the book?");
gets(batch[a].title);
}

void authorsearch()
{ int a;
puts("Enter the author of the book?");
gets(batch[a].author);
}

void categorysearch()
{ int a;
puts("Enter the category of the book?");
gets(batch[a].category);
}

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are types of preprocessor in c?

607


what are non standard function in c

1420


What is anagram in c?

508


which is conditional construct a) if statement b) switch statement c) while/for d) goto

726


What do you mean by scope of a variable in c?

532






Did c have any year 2000 problems?

644


Does c have class?

599


Explain Function Pointer?

671


How do you sort filenames in a directory?

694


What is the use of function overloading in C?

661


What is pivot in c?

558


Can you tell me how to check whether a linked list is circular?

749


code for replace tabs with equivalent number of blanks

1625


What is storage class?

637


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

572