Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Note: the program should be written only in C++ Implement a C++ project that con

ID: 3596043 • Letter: N

Question

Note: the program should be written only in C++

Implement a C++ project that consists of separate files to manage a list of books. Specifically, write down the header file to include the following content in this submission: a nique book D author only the fist a or is ons ered Design and declare a struct Book to include the following three attributes of a boo c book has more than one author), and (3) name of the book . a void addBook( vector Book> &bookList;, Book &newBook;) This function will add newBook to bookList if it is not already in bookList. int backupBookList( vector-Book> &bookList;, Book* &backupList;) This function copies all the books stored in bookList to a dynamic array managed by the backupList pointer and returns the size of this dynamic array void destructBackupList(Book* &backupList;); This function returns the space occupied by the pointee of backupList.

Explanation / Answer

#include<iostream.h>

#include<conio.h>

#include<vector.h>

using namespace std;

struct{

ID int,

author string,

name string

}Book;

class BookList{

void addBook(Vector<Book> &bookList, Book &newBook){

  if (std::find(bookList.begin(), bookList.end(),newBook)==bookList.end())

bookList.push_back(newBook);

}

int backupBookList(Vector<Book> &bookList, Book &backupList){

  *backupList = &bookList[0];

return sizeof(backupList)/sizeof(*backupList);

}

int backupBookList(Book &backupList){

return sizeof(backupList);

}

}

'push_back()' - function used to insert the data into the vector

sizeof(array) - function used to find the total space occupied by the array.

sizeof(*array) - will return the totla spaceoccupied by the first element of the array

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote