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
What are types of preprocessor in c?
what are non standard function in c
What is anagram in c?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
What do you mean by scope of a variable in c?
Did c have any year 2000 problems?
Does c have class?
Explain Function Pointer?
How do you sort filenames in a directory?
What is the use of function overloading in C?
What is pivot in c?
Can you tell me how to check whether a linked list is circular?
code for replace tabs with equivalent number of blanks
What is storage class?
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