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

Efficient data structure for store/search list of 1000 records a)array b)double linked list c)circular queue d)hash table

3 Answers   Value Labs,


write a program to remove occurrences the word from entered text?

1 Answers  


Discuss similarities and differences of Multiprogramming OS and multiprocessing OS?

4 Answers   TCS,


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

0 Answers   Aspire, Infogain,


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL

0 Answers  






What is modeling?

0 Answers  


Write a program to accept a character & display its corrosponding ASCII value & vice versa?

9 Answers  


WAP to accept basic salary of an employee? Calculate it HRA=25%,DA=30%,PF=30%&net salary display all contents?

6 Answers   Finite Infotech, Lovely Professional University, Wipro,


WHAT IS MAXIMUM SIZE OF AN ARRAY IN C LANGUAGE?

8 Answers   Carphone Warehouse, IBM, SAS,


Why do we use static in c?

0 Answers  


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

0 Answers  


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

0 Answers   Wipro,


Categories