Record Detail

Compile Error

/in/simulation.cpp: In function 'int isSpecies(std::__cxx11::string, const world_t&)':
/in/simulation.cpp:28:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < world.numSpecies; i++){
                     ~~^~~~~~~~~~~~~~~~~~
/in/simulation.cpp: In function 'int overlapWith(int, int, const world_t&)':
/in/simulation.cpp:42:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < world.numCreatures; i++){
                     ~~^~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp: In function 'bool initWorld(world_t&, const string&, const string&)':
/in/simulation.cpp:49:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < MAXCREATURES; i++){
                     ~~^~~~~~~~~~~~~~
/in/simulation.cpp:52:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < MAXHEIGHT; i++){
                     ~~^~~~~~~~~~~
/in/simulation.cpp:53:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int j = 0; j < MAXWIDTH; j++){
                         ~~^~~~~~~~~~
/in/simulation.cpp:139:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (h < 1 || h > MAXHEIGHT){
                  ~~^~~~~~~~~~~
/in/simulation.cpp:143:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     if (w < 1 || w > MAXWIDTH){
                  ~~^~~~~~~~~~
/in/simulation.cpp: In function 'void printGrid(const grid_t&)':
/in/simulation.cpp:255:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < grid.height; i++){
                     ~~^~~~~~~~~~~~~
/in/simulation.cpp:256:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int j = 0; j < grid.width; j++){
                         ~~^~~~~~~~~~~~
/in/simulation.cpp: In function 'void simulateCreature(creature_t&, grid_t&, bool)':
/in/simulation.cpp:276:41: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (hopPt.r >= 0 && hopPt.r < grid.height && hopPt.c >= 0 && hopPt.c < grid.width && !grid.squares[hopPt.r][hopPt.c]){
                                 ~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:276:82: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (hopPt.r >= 0 && hopPt.r < grid.height && hopPt.c >= 0 && hopPt.c < grid.width && !grid.squares[hopPt.r][hopPt.c]){
                                                                          ~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:314:47: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (infectPt.r >= 0 && infectPt.r < grid.height && infectPt.c >= 0 && infectPt.c < grid.width
                                    ~~~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:314:94: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (infectPt.r >= 0 && infectPt.r < grid.height && infectPt.c >= 0 && infectPt.c < grid.width
                                                                                   ~~~~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:328:45: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (emptyPt.r >= 0 && emptyPt.r < grid.height && emptyPt.c >= 0 && emptyPt.c < grid.width && !grid.squares[emptyPt.r][emptyPt.c]){
                                   ~~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:328:90: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (emptyPt.r >= 0 && emptyPt.r < grid.height && emptyPt.c >= 0 && emptyPt.c < grid.width && !grid.squares[emptyPt.r][emptyPt.c]){
                                                                                ~~~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:343:45: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (enemyPt.r >= 0 && enemyPt.r < grid.height && enemyPt.c >= 0 && enemyPt.c < grid.width
                                   ~~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:343:90: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (enemyPt.r >= 0 && enemyPt.r < grid.height && enemyPt.c >= 0 && enemyPt.c < grid.width
                                                                                ~~~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:359:43: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (samePt.r >= 0 && samePt.r < grid.height && samePt.c >= 0 && samePt.c < grid.width
                                  ~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:359:86: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (samePt.r >= 0 && samePt.r < grid.height && samePt.c >= 0 && samePt.c < grid.width
                                                                             ~~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:375:42: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (wallPt.r < 0 || wallPt.r >= grid.height || wallPt.c < 0 || wallPt.c >= grid.width){
                                 ~~~~~~~~~^~~~~~~~~~~~~~
/in/simulation.cpp:375:85: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (wallPt.r < 0 || wallPt.r >= grid.height || wallPt.c < 0 || wallPt.c >= grid.width){
                                                                            ~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp: In function 'void printOutcome(world_t&, int, bool)':
/in/simulation.cpp:401:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int j = 0; j < world.numCreatures; j++){
                         ~~^~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 3
Language
C++
Submit At
2024-11-12 16:06:00
Judged At
2024-11-12 16:06:00
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes