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]

Answers were Sorted based on User's Feedback



Define a structure to store the record of library. The record must consist of at least following f..

Answer / 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

Define a structure to store the record of library. The record must consist of at least following f..

Answer / sharmaak

Solution is simple. Have a library data structure as a struct containing all the fields
struct library
{
char title[30];
char author[30];
char edition[30];
char price[30];
char publisher[30];
char category[30];
};

But have separate data structure which make different fields searchable in log(n) time.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

0 Answers  


write aprogram for There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.

1 Answers   iGate, Shashi, Source Bits, Subex,


What is 2c dna?

0 Answers  


Can we use any name in place of argv and argc as command line arguments?

0 Answers  


what are the different storage classes in c?

0 Answers   TCS,






#include<stdio.h> int main() { int a[3][3][2]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; printf("%d\n",*(*(*a+1)); return 0; } What will be the output of the above question? And how?

1 Answers   Groupon,


Given an unsigned integer, find if the number is power of 2?

5 Answers  


Hi Every one...........I have been selected for the SBI Clerk. But i m one month Pregnanat. So anyone please suggest me, is they take any objection on my joining .

4 Answers   State Bank Of India SBI,


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

0 Answers   Sikkim Manipal University,


What are c preprocessors?

0 Answers  


Write a program to show the change in position of a cursor using c

0 Answers  


Program to swap the any two elements in an array containing N number of elements?

1 Answers   Bosch, Glenwood, Ugam Solutions,


Categories