Record Detail

Compile Error

/in/ex4.cpp: In member function 'virtual int bookInventory::searchBook(const string&) const':
/in/ex4.cpp:22:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = 0; i < numBooks; i++) {
                   ~~^~~~~~~~~~
/in/ex4.cpp: In member function 'virtual void bookInventory::removeBook(int)':
/in/ex4.cpp:48:26: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = ID - 1; i < numBooks - 1; i++) {
                        ~~^~~~~~~~~~~~~~
/in/ex4.cpp: In member function 'virtual void bookInventory::printInventory() const':
/in/ex4.cpp:59:14: error: 'cout' is not a member of 'std'
         std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << "\n" << "Available: " << (books[i].isAvailable ? "Yes" : "No") << std::endl;
              ^~~~
/in/ex4.cpp:59:14: note: suggested alternative: 'copy'
         std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << "\n" << "Available: " << (books[i].isAvailable ? "Yes" : "No") << std::endl;
              ^~~~
              copy
/in/ex4.cpp:59:197: error: 'endl' is not a member of 'std'
         std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << "\n" << "Available: " << (books[i].isAvailable ? "Yes" : "No") << std::endl;
                                                                                                                                                                                                     ^~~~
/in/ex4.cpp:59:197: note: suggested alternative: 'end'
         std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << "\n" << "Available: " << (books[i].isAvailable ? "Yes" : "No") << std::endl;
                                                                                                                                                                                                     ^~~~
                                                                                                                                                                                                     end
/in/ex4.cpp: In member function 'void library::listBorrowed() const':
/in/ex4.cpp:89:18: error: 'cout' is not a member of 'std'
             std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << std::endl;
                  ^~~~
/in/ex4.cpp:89:18: note: suggested alternative: 'copy'
             std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << std::endl;
                  ^~~~
                  copy
/in/ex4.cpp:89:135: error: 'endl' is not a member of 'std'
             std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << std::endl;
                                                                                                                                       ^~~~
/in/ex4.cpp:89:135: note: suggested alternative: 'end'
             std::cout << "Book ID: " << i + 1 << "\n" << "Title: " << books[i].title << "\n" << "Author: " << books[i].author << std::endl;
                                                                                                                                       ^~~~
                                                                                                                                       end
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-20 16:19:18
Judged At
2024-11-20 16:19:18
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes