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
I need previous papers of CSC.......plz help out by posting them.......
Can you please explain the difference between strcpy() and memcpy() function?
What are the salient features of c languages?
What are the ways to a null pointer can use in c programming language?
What is a pointer in c plus plus?
Can we change the value of constant variable in c?
What does c mean in standard form?
Why is main function so important?
4. main() { int c=- -2; printf("c=%d",c); }
i want to know the procedure of qualcomm for getting a job through offcampus
how logic is used
What is use of integral promotions in c?
What oops means?
what value is returned to operating system after program execution?
What is the difference between āgā and āgā in C?