Record Detail

Compile Error

/in/ex4.cpp: In function 'int main()':
/in/ex4.cpp:23:39: error: ISO C++ forbids variable length array [-Werror=vla]
     pixel* pond = new pixel[rows][cols];
                                       ^
/in/ex4.cpp:23:39: error: array size in new-expression must be constant
/in/ex4.cpp:23:39: error: the value of 'cols' is not usable in a constant expression
/in/ex4.cpp:21:15: note: 'int cols' is not const
     int rows, cols;
               ^~~~
/in/ex4.cpp:26:27: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
             cin >> pond[i][j].item;
                           ^
/in/ex4.cpp:36:28: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                 if (pond[i][j].read == false)
                            ^
/in/ex4.cpp:46:20: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
             pond[i][j].read = true;
                    ^
/in/ex4.cpp:47:24: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
             if (pond[i][j].item != 2){
                        ^
/in/ex4.cpp:49:44: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                 connected.push_back(pond[i][j].item);
                                            ^
/in/ex4.cpp:51:32: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i][j+1].item != 2 && pond[i][j+1].read == false)
                                ^
/in/ex4.cpp:51:58: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i][j+1].item != 2 && pond[i][j+1].read == false)
                                                          ^
/in/ex4.cpp:52:52: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                         connected.push_back(pond[i][j+1].item);
                                                    ^
/in/ex4.cpp:55:32: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i][j-1].item != 2 && pond[i][j-1].read == false)
                                ^
/in/ex4.cpp:55:58: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i][j-1].item != 2 && pond[i][j-1].read == false)
                                                          ^
/in/ex4.cpp:56:52: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                         connected.push_back(pond[i][j-1].item);
                                                    ^
/in/ex4.cpp:59:34: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i-1][j].item != 2 && pond[i-1][j].read == false)
                                  ^
/in/ex4.cpp:59:60: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i-1][j].item != 2 && pond[i-1][j].read == false)
                                                            ^
/in/ex4.cpp:60:54: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                         connected.push_back(pond[i-1][j].item);
                                                      ^
/in/ex4.cpp:63:34: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i+1][j].item != 2 && pond[i+1][j].read == false)
                                  ^
/in/ex4.cpp:63:60: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                     if (pond[i+1][j].item != 2 && pond[i+1][j].read == false)
                                                            ^
/in/ex4.cpp:64:54: error: no match for 'operator[]' (operand types are 'pixel' and 'int')
                         connected.push_back(pond[i+1][j].item);
                                                      ^
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Final Exam
Language
C++
Submit At
2022-08-02 15:43:58
Judged At
2022-08-06 15:09:22
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes