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

I need previous papers of CSC.......plz help out by posting them.......

1816


Can you please explain the difference between strcpy() and memcpy() function?

602


What are the salient features of c languages?

623


What are the ways to a null pointer can use in c programming language?

588


What is a pointer in c plus plus?

692






Can we change the value of constant variable in c?

572


What does c mean in standard form?

594


Why is main function so important?

613


4. main() { int c=- -2; printf("c=%d",c); }

1366


i want to know the procedure of qualcomm for getting a job through offcampus

1938


how logic is used

1497


What is use of integral promotions in c?

664


What oops means?

582


what value is returned to operating system after program execution?

1602


What is the difference between ā€˜gā€™ and ā€œgā€ in C?

2531