Record Detail

Compile Error

/in/ex4.cpp: In constructor 'bookInventory::bookInventory()':
/in/ex4.cpp:9:9: error: 'inventory' was not declared in this scope
         inventory[i] = Book();
         ^~~~~~~~~
/in/ex4.cpp:9:9: note: suggested alternative: 'bookInventory'
         inventory[i] = Book();
         ^~~~~~~~~
         bookInventory
/in/ex4.cpp: In member function 'virtual void bookInventory::addBook(const Book&)':
/in/ex4.cpp:19:5: error: 'inventory' was not declared in this scope
     inventory[numBooks++] = book;
     ^~~~~~~~~
/in/ex4.cpp:19:5: note: suggested alternative: 'bookInventory'
     inventory[numBooks++] = book;
     ^~~~~~~~~
     bookInventory
/in/ex4.cpp: In member function 'virtual int bookInventory::searchBook(const string&) const':
/in/ex4.cpp:24:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < numBooks; ++i) {
                     ~~^~~~~~~~~~
/in/ex4.cpp:25:13: error: 'inventory' was not declared in this scope
         if (inventory[i].title == title) {
             ^~~~~~~~~
/in/ex4.cpp:25:13: note: suggested alternative: 'bookInventory'
         if (inventory[i].title == title) {
             ^~~~~~~~~
             bookInventory
/in/ex4.cpp: In member function 'virtual void bookInventory::setBook(const Book&, int)':
/in/ex4.cpp:37:5: error: 'inventory' was not declared in this scope
     inventory[ID - 1] = book;
     ^~~~~~~~~
/in/ex4.cpp:37:5: note: suggested alternative: 'bookInventory'
     inventory[ID - 1] = book;
     ^~~~~~~~~
     bookInventory
/in/ex4.cpp: In member function 'virtual Book bookInventory::viewBook(int) const':
/in/ex4.cpp:42:41: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID <= 0 || ID > MAX_BOOKS || ID > numBooks) {
                                      ~~~^~~~~~~~~~
/in/ex4.cpp:45:12: error: 'inventory' was not declared in this scope
     return inventory[ID - 1];
            ^~~~~~~~~
/in/ex4.cpp:45:12: note: suggested alternative: 'bookInventory'
     return inventory[ID - 1];
            ^~~~~~~~~
            bookInventory
/in/ex4.cpp: In member function 'virtual void bookInventory::removeBook(int)':
/in/ex4.cpp:50:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID <= 0 || ID > numBooks) {
                    ~~~^~~~~~~~~~
/in/ex4.cpp:53:28: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = ID - 1; i < numBooks - 1; ++i) {
                          ~~^~~~~~~~~~~~~~
/in/ex4.cpp:54:9: error: 'inventory' was not declared in this scope
         inventory[i] = inventory[i + 1];
         ^~~~~~~~~
/in/ex4.cpp:54:9: note: suggested alternative: 'bookInventory'
         inventory[i] = inventory[i + 1];
         ^~~~~~~~~
         bookInventory
/in/ex4.cpp:56:5: error: 'inventory' was not declared in this scope
     inventory[numBooks - 1] = Book(); // Clear last slot
     ^~~~~~~~~
/in/ex4.cpp:56:5: note: suggested alternative: 'bookInventory'
     inventory[numBooks - 1] = Book(); // Clear last slot
     ^~~~~~~~~
     bookInventory
/in/ex4.cpp: In member function 'virtual void bookInventory::printInventory() const':
/in/ex4.cpp:65:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < numBooks; ++i) {
                     ~~^~~~~~~~~~
/in/ex4.cpp:67:35: error: 'inventory' was not declared in this scope
                   << "Title: " << inventory[i].title << "\n"
                                   ^~~~~~~~~
/in/ex4.cpp:67:35: note: suggested alternative: 'bookInventory'
                   << "Title: " << inventory[i].title << "\n"
                                   ^~~~~~~~~
                                   bookInventory
/in/ex4.cpp: At global scope:
/in/ex4.cpp:74:1: error: 'Library' does not name a type; did you mean 'library'?
 Library::Library() : bookInventory() {}
 ^~~~~~~
 library
/in/ex4.cpp:77:6: error: 'Library' has not been declared
 void Library::borrowBook(int ID) {
      ^~~~~~~
/in/ex4.cpp: In function 'void borrowBook(int)':
/in/ex4.cpp:78:18: error: 'inventory' was not declared in this scope
     Book &book = inventory[ID - 1];
                  ^~~~~~~~~
/in/ex4.cpp:78:18: note: suggested alternative: 'bookInventory'
     Book &book = inventory[ID - 1];
                  ^~~~~~~~~
                  bookInventory
/in/ex4.cpp:79:25: error: 'numBooks' was not declared in this scope
     if (ID <= 0 || ID > numBooks) {
                         ^~~~~~~~
/in/ex4.cpp:79:25: note: suggested alternative: 'Book'
     if (ID <= 0 || ID > numBooks) {
                         ^~~~~~~~
                         Book
/in/ex4.cpp: At global scope:
/in/ex4.cpp:89:6: error: 'Library' has not been declared
 void Library::returnBook(int ID) {
      ^~~~~~~
/in/ex4.cpp: In function 'void returnBook(int)':
/in/ex4.cpp:90:18: error: 'inventory' was not declared in this scope
     Book &book = inventory[ID - 1];
                  ^~~~~~~~~
/in/ex4.cpp:90:18: note: suggested alternative: 'bookInventory'
     Book &book = inventory[ID - 1];
                  ^~~~~~~~~
                  bookInventory
/in/ex4.cpp:91:25: error: 'numBooks' was not declared in this scope
     if (ID <= 0 || ID > numBooks) {
                         ^~~~~~~~
/in/ex4.cpp:91:25: note: suggested alternative: 'Book'
     if (ID <= 0 || ID > numBooks) {
                         ^~~~~~~~
                         Book
/in/ex4.cpp: At global scope:
/in/ex4.cpp:101:6: error: 'Library' has not been declared
 void Library::listBorrowed() const {
      ^~~~~~~
/in/ex4.cpp:101:30: error: non-member function 'void listBorrowed()' cannot have cv-qualifier
 void Library::listBorrowed() const {
                              ^~~~~
/in/ex4.cpp: In function 'void listBorrowed()':
/in/ex4.cpp:103:25: error: 'numBooks' was not declared in this scope
     for (int i = 0; i < numBooks; ++i) {
                         ^~~~~~~~
/in/ex4.cpp:103:25: note: suggested alternative: 'Book'
     for (int i = 0; i < numBooks; ++i) {
                         ^~~~~~~~
                         Book
/in/ex4.cpp:104:14: error: 'inventory' was not declared in this scope
         if (!inventory[i].isAvailable) {
              ^~~~~~~~~
/in/ex4.cpp:104:14: note: suggested alternative: 'bookInventory'
         if (!inventory[i].isAvailable) {
              ^~~~~~~~~
              bookInventory
cc1plus: all warnings being treated as errors
/in/compile/Makefile:26: recipe for target 'ex4.o' failed
make: *** [ex4.o] Error 1

Information

Submit By
Type
Submission
Homework
Exercise 4
Language
C++
Submit At
2024-11-22 12:46:12
Judged At
2024-11-22 12:46:12
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes