Record Detail

Compile Error

In file included from /in/driver/main.cpp:1:0:
/in/shortestP2P.hpp: In member function 'void ShortestP2P::readGraph()':
/in/shortestP2P.hpp:45:42: error: ISO C++ forbids variable length array [-Werror=vla]
     edge = new int[(int)num_v][(int)num_v];
                                          ^
/in/shortestP2P.hpp:45:42: error: array size in new-expression must be constant
/in/shortestP2P.hpp:45:42: error: 'this' is not a constant expression
/in/shortestP2P.hpp:47:7: error: expected '(' before 'for'
       for (unsigned int i = 0; i < num_v; i++)
       ^~~
/in/shortestP2P.hpp:47:7: error: expected primary-expression before 'for'
/in/shortestP2P.hpp:47:32: error: 'i' was not declared in this scope
       for (unsigned int i = 0; i < num_v; i++)
                                ^
/in/shortestP2P.hpp:56:16: error: invalid types 'int[unsigned int]' for array subscript
       edge[i][i] = 0;
                ^
/in/shortestP2P.hpp:65:22: error: invalid types 'int[unsigned int]' for array subscript
       edge[start][end] = weight;
                      ^
/in/shortestP2P.hpp:75:24: error: invalid types 'int[unsigned int]' for array subscript
           if (edge[i][j] != INF && edge[j][k] != INF) // Check if the paths i->j and j->k exist
                        ^
/in/shortestP2P.hpp:75:45: error: invalid types 'int[unsigned int]' for array subscript
           if (edge[i][j] != INF && edge[j][k] != INF) // Check if the paths i->j and j->k exist
                                             ^
/in/shortestP2P.hpp:77:26: error: invalid types 'int[unsigned int]' for array subscript
             if (edge[i][j] + edge[j][k] < edge[i][k])
                          ^
/in/shortestP2P.hpp:77:39: error: invalid types 'int[unsigned int]' for array subscript
             if (edge[i][j] + edge[j][k] < edge[i][k])
                                       ^
/in/shortestP2P.hpp:77:52: error: invalid types 'int[unsigned int]' for array subscript
             if (edge[i][j] + edge[j][k] < edge[i][k])
                                                    ^
/in/shortestP2P.hpp:79:24: error: invalid types 'int[unsigned int]' for array subscript
               edge[i][k] = edge[i][j] + edge[j][k];
                        ^
/in/shortestP2P.hpp:79:37: error: invalid types 'int[unsigned int]' for array subscript
               edge[i][k] = edge[i][j] + edge[j][k];
                                     ^
/in/shortestP2P.hpp:79:50: error: invalid types 'int[unsigned int]' for array subscript
               edge[i][k] = edge[i][j] + edge[j][k];
                                                  ^
/in/shortestP2P.hpp:84:22: error: invalid types 'int[unsigned int]' for array subscript
         if (edge[i][i] < 0)
                      ^
/in/shortestP2P.hpp: In member function 'void ShortestP2P::distance(unsigned int, unsigned int)':
/in/shortestP2P.hpp:110:18: error: invalid types 'int[unsigned int]' for array subscript
     if (edge[A][B] == INF)
                  ^
/in/shortestP2P.hpp:116:24: error: invalid types 'int[unsigned int]' for array subscript
       cout << edge[A][B] << endl;
                        ^
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 4
Language
C++
Submit At
2022-07-31 16:29:31
Judged At
2022-07-31 16:29:31
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes