Record Detail

Compile Error

/in/ex4.cpp: In member function 'virtual int bookInventory::searchBook(const string&) const':
/in/ex4.cpp:22:23: 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::setBook(const Book&, int)':
/in/ex4.cpp:36:12: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID > numBooks) {
         ~~~^~~~~~~~~~
/in/ex4.cpp: In member function 'virtual Book bookInventory::viewBook(int) const':
/in/ex4.cpp:43:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID <= 0 || ID > numBooks) {
                    ~~~^~~~~~~~~~
/in/ex4.cpp: In member function 'virtual void bookInventory::removeBook(int)':
/in/ex4.cpp:51:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID <= 0 || ID > numBooks) {
                    ~~~^~~~~~~~~~
/in/ex4.cpp:54:28: 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:66:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < numBooks; ++i) {
                     ~~^~~~~~~~~~
/in/ex4.cpp: In member function 'void library::borrowBook(int)':
/in/ex4.cpp:79:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID <= 0 || ID > numBooks) {
                    ~~~^~~~~~~~~~
/in/ex4.cpp: In member function 'void library::returnBook(int)':
/in/ex4.cpp:90:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (ID <= 0 || ID > numBooks) {
                    ~~~^~~~~~~~~~
/in/ex4.cpp: In member function 'void library::listBorrowed() const':
/in/ex4.cpp:102:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < numBooks; ++i) {
                     ~~^~~~~~~~~~
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:51:43
Judged At
2024-11-22 12:51:43
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes