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; | ||
| } | ||

___________
| @@ -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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f51bcaa8378_46666f51bca4d16a.jpg)
____
| @@ -0,0 +1,27 @@ | ||
| #include | ||
| #include | ||
| #include | ||
| #include | ||
| #include "book.h" | ||
| using namespace std; | ||
| const map | ||
| const map | ||
| int main() | ||
| { | ||
| vector | ||
| 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; | ||
| } | ||

__
| 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 |

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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
