0

https://code.sololearn.com/cXvLaqN0zV76/?ref=app

Hello! Can anyone explain me this code? I'm facing difficulty to understand completely this code I'd really thankful to you

9th Jun 2022, 2:41 PM
Syed Hammad Javed
4 Answers
+ 5
Add link in description place. Not in question, it won't work there.. https://code.sololearn.com/cXvLaqN0zV76/?ref=app it's hard to explain a that much lines of code with message replys.. so put some effort to understand it and break code into small parts, mention short specific lines of which is not understand by you.... basically, main class Library tells, it has operation to be perform are : setting book data like name, author, price, copies.. display information about specific book. search if a book is available or not..
9th Jun 2022, 2:46 PM
Jayakrishna 🇼🇳
+ 1
Thank you for replying sir Basically i didn't last two functions definitions from line 36-63. And in main function why flag is used?
9th Jun 2022, 3:27 PM
Syed Hammad Javed
+ 1
This display function displays the properties " Title, author, publisher,price,copies", of library object which you set by setdata() method void Libary::display() { cout<<"\n "<<title<<"\t\t "<<author<<"\t\t "<<publisher<<" \t\t\t "<<price<<"\t "<<stock; } This search function check if the given book is available with title and author given as argument to function. int Libary::search(char t[],char a[]) { it returns 0 if book is available else returns 1 strcmp(a,b) returns 0 if both strings a, b are equal otherwise returns negative number if a<b, positive number if a>b if(strcmp(title,t)&&(strcmp(author,a))) { return 0; } else { return 1; } } This function return displays the total copies price of book with title if available, else displays not available... void Libary::nocopies(int num) { if(stock>=num) { cout<<"\n Title is avilable"; cout<<"\n Cost of"<<num<<"Books is Rs."<<(price*num); } else { cout<<"\n Required copies not in stock"; } } Hope it helps....
9th Jun 2022, 4:08 PM
Jayakrishna 🇼🇳
+ 1
Thank you very much sir
9th Jun 2022, 4:25 PM
Syed Hammad Javed