Question: In C++. Please those codes are incomplete or need to be fixed. #include book.h book::book(string author, string title, string subject, genreType g[],int numberOfGenre, string publisher,

In C++. Please those codes are incomplete or need to be fixed.

#include "book.h"
book::book(string author, string title, string subject, genreType g[],int numberOfGenre, string publisher, string callNum, string isbn)
{
this->author = author;
this->title = title;
this->subject = subject;
this->publisher = publisher;
this->callNum = callNum;
this->isbn = isbn;
this->genre = new genreType[numberOfGenre];
for(int i = 0; i
{
this->genre[i] = g[i];
}
}
book::~book()
{
//cout
delete [] genre;
}

In C++. Please those codes are incomplete or need to be fixed.

___________

@@ -0,0 +1,26 @@
#ifndef BOOK_H
#define BOOK_H
#include
using std::string;
enum genreType {NONFICTION, FICTION, SCIFI, CHILD, HORROR, FANTASY, AUTOBIO, BIO};
class book
{
public:
book(string, string, string, genreType[],int, string, string, string);
~book();
private:
string author;
string title;
string subject;
genreType* genre;
string publisher;
string callNum;
string isbn;
};

#endif

#include "book.h" book::book(string author, string title, string subject, genreType g[],int numberOfGenre, string

____

@@ -0,0 +1,27 @@
#include
#include
#include
#include
#include "book.h"
using namespace std;
const map genreToString {{NONFICTION, "Non-Fiction"},{FICTION, "Fiction"}, {SCIFI, "Science Fiction"}, {CHILD, "Childrens"}, {HORROR, "Horror"}, {FANTASY, "Fantasy"}, {AUTOBIO, "Autobiography"}, {BIO, "Biography"}};
const map stringToGenre{{"Non-Fiction", NONFICTION},{"Fiction", FICTION}, {"Science Fiction", SCIFI}, {"Childrens", CHILD}, {"Horror", HORROR}, {"Fantasy", FANTASY}, {"Autobiography", AUTOBIO}, {"Biography", BIO}};
int main()
{
vector library;
genreType genres[] = {FICTION, CHILD, FANTASY};
book myBook("author", "title", "subject", genres, 3, "publisher", "callNum", "isbn");
library.push_back(myBook);
for(int i = 0; i
{
}
return 0;
}

publisher, string callNum, string isbn) { this->author = author; this->title = title;

__

all: book
g++ -pedantic-errors -g main.cpp book
book: book.h book.cpp
g++ -pedantic-errors -g -c book.cpp -o book
clean:
rm book
rm a.out

this->subject = subject; this->publisher = publisher; this->callNum = callNum; this->isbn = isbn;

24 - 1_22_22/book.cpp 08-8, +1,24 28 1 + #include "book.h" 2 + 3 + book:: book(string author, string title, string subject, genreType g[], int numberofcenre, string publisher, string callNum, string isbn) 4 5 + 8 + 7 + 8 + this->author = author; this->title = title; this->subject - subject; this->publisher - publisher; this->callNum = callNum; this-isbn - isbn; this->genre = new genreType(numberOfGenre); for(int i = 0; i genre[1] = [1]; 15 + 3 16 17 + 18 19 20 + book::-book() + 1 //cout 2 2 4 + 5 + + using std::string: 6 + 7 + enum genreType {NONFICTION, FICTION, SCIFI, CHILD, HORROR, FANTASY, AUTOBIO, BIO); + 8 9 + 10 11 12 13 14 + 15 16 + + class book + + public: + book(string, string, string, genreType[], int, string, string, string); book(); + private: string author; string title; string subject; genreType* genre; string publisher; string callNum; string isbn; 17 + 18 + 19 20 + 21 + 22 + 23 + 24 + }; 25 + 26 + #endif O 27 H 1_22_22/main.cpp 40 - 8,0 +1,27 0 1 + #include 2 + #include 3 + #include 4 4 + #include 5 + #include "book.h" + 6 7 8 + using namespace std; + + const map genreToString {{NONFICTION, "Non-Fiction"},{FICTION, "Fiction"}, {SCIFI, "Science Fiction"), (CHILD, "Childrens"), CHORROR, "Horror"}, (FA + const map stringTogenre{{"Non-Fiction", NONFICTION}, {"Fiction", FICTION}, {"Science Fiction", SCIFI), {"Childrens", CHILD), ("Horror", HORROR}, {" 9 le 11 + 12 + 13 + 14 15 16 + 17 + + int main() + 1 vector library; genreType genres[] - [FICTION, CHILD, FANTASY}; {, book my Book ("author", "title", "subject", genres, 3, "publisher", "callium", "isbn"); library.push_back(myBook); for(int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!