Record Detail

Compile Error

/in/exam3_matrix.cpp:15:56: error: could not convert '(int* (*)[1])operator new [](8)' from 'int* (*)[1]' to 'int*'
     intMatrix(int rows=1,int cols=1,int* flatternArray=new int*[1][1]){
                                                        ^~~~~~~~~~~~~~
/in/exam3_matrix.cpp: In constructor 'intMatrix::intMatrix(int, int, int*)':
/in/exam3_matrix.cpp:18:41: error: ISO C++ forbids variable length array [-Werror=vla]
         flatternArray=new int[rows][cols];
                                         ^
/in/exam3_matrix.cpp:18:41: error: array size in new-expression must be constant
/in/exam3_matrix.cpp:18:41: error: 'cols' is not a constant expression
/in/exam3_matrix.cpp: In member function 'void intMatrix::fillFrom(std::vector<int>&)':
/in/exam3_matrix.cpp:36:39: error: invalid types 'int[int]' for array subscript
                     flatternArray[j][i]=source[i*cols+cols+1];
                                       ^
/in/exam3_matrix.cpp: In member function 'int intMatrix::getElement(int, int)':
/in/exam3_matrix.cpp:43:48: error: invalid types 'int[int]' for array subscript
         return flatternArray[rowNum-1][colNum-1];
                                                ^
/in/exam3_matrix.cpp: In member function 'void intMatrix::saveTo(std::__cxx11::string)':
/in/exam3_matrix.cpp:53:67: error: invalid types 'int[int]' for array subscript
             for (int j=0;j<cols-1;++j){outfile<<flatternArray[i][j]<<",";}
                                                                   ^
/in/exam3_matrix.cpp:54:45: error: invalid types 'int[int]' for array subscript
             outfile<<flatternArray[i][cols-1]<<endl;
                                             ^
cc1plus: all warnings being treated as errors

Information

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