Record Detail

Compile Error

/in/ex5.cpp: In member function 'void bookInventory::removeBook(int)':
/in/ex5.cpp:26:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if (ID < 0 || ID >= numBooks) {
                 ~~~^~~~~~~~~~~
/in/ex5.cpp:29:22: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = ID; i < numBooks - 1; i++) {
                    ~~^~~~~~~~~~~~~~
/in/ex5.cpp: In member function 'void bookInventory::printInventory() const':
/in/ex5.cpp:40:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = 0; i < numBooks; i++) {
                   ~~^~~~~~~~~~
/in/ex5.cpp: In member function 'bool bookInventory::repOK()':
/in/ex5.cpp:48:16: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
   if (numBooks < 0 || numBooks > size) {
       ~~~~~~~~~^~~
/in/ex5.cpp:60:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = 0; i < numBooks; i++) {
                   ~~^~~~~~~~~~
/in/ex5.cpp:66:28: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = numBooks; i < size; i++) {
                          ~~^~~~~~
cc1plus: all warnings being treated as errors
/in/compile/Makefile:26: recipe for target 'ex5.o' failed
make: *** [ex5.o] Error 1

Information

Submit By
Type
Submission
Homework
Exercise 5
Language
C++
Submit At
2024-11-27 16:27:18
Judged At
2024-11-27 16:27:18
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes