Please make the modifications in "C programme" and try to complete all three parts kindly. #include #include struct library{ int id; char title[40]; char author[20]; float price; } b[100] ; int num=0; void Add(){ printf("How many books' info do you want to enter? "); scanf(" %d",&num); for(int i=0;i
Please make the modifications in "C programme" and try to complete all three parts kindly.
#include<stdio.h>
#include<string.h>
struct library{
int id;
char title[40];
char author[20];
float price;
} b[100] ;
int num=0;
void Add(){
printf("How many books' info do you want to enter? ");
scanf(" %d",&num);
for(int i=0;i<num;i++){
printf("Enter the following information about the book:\n");
printf("ID, title, author's name, price(in Tk)\n");
scanf(" %d %s %s %f",&b[i].id,&b[i].title,&b[i].author,&b[i].price);
}
}
void Disp(){
printf("\tID\tName\tAuthor\tPrice(Tk)\n");
for(int i=0;i<num;i++){
printf("\t%d\t%s\t%s\t%f\n",b[i].id,b[i].title,b[i].author,b[i].price);
}
}
void Count(){
printf("\nNo of books avalable in the library = %d\n",num);
}
void List(){
char str[20];
printf("Enter the author's name: ");
scanf("%s",str);
for(int i=0;i<num;i++){
if(strcmp(str,b[i].author)==0)
printf("\n\t%d\t%s\t%s\t%f\n",b[i].id,b[i].title,b[i].author,b[i].price);
}
}
int main(){
int option=0;
do {
printf("\nWelcome to the library\nPlease Select an Option: \n");
printf("-----------------------------------------------------------
\n");
printf("1.Add book details\n2.Display book details\n3.List all books of a given author\n4.Show total no. of books in the library.\n5.Exit\n");
printf("-----------------------------------------------------------
\n");
scanf("%d",&option);
switch(option){
case 1: Add();
break;
case 2: Disp();
break;
case 3: List();
break;
case 4: Count();
break;
}
}while(option != 5);
return 0;
}
Make the following modifications to the code
- Add a password-protected authorization system so that option-1 can be used by the librarian only
- Enable the use of multi-word strings in book titles and author names
- Make the system dynamic: make sure that the newly input book info does not overwrite the previous ones
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)