Record Detail

Compile Error

/in/ex6.cpp: In member function 'int BinaryTree::sum() const':
/in/ex6.cpp:59:9: error: redeclaration of 'int sumOfTree'
     int sumOfTree = root->val + leftSum + rightSum;
         ^~~~~~~~~
/in/ex6.cpp:45:9: note: 'int sumOfTree' previously declared here
     int sumOfTree, rightSum, leftSum;
         ^~~~~~~~~
/in/ex6.cpp: In member function 'int BinaryTree::depth() const':
/in/ex6.cpp:70:9: error: redeclaration of 'int rightDepth'
     int rightDepth = 0;
         ^~~~~~~~~~
/in/ex6.cpp:68:33: note: 'int rightDepth' previously declared here
     int depthOfTree, leftDepth, rightDepth;
                                 ^~~~~~~~~~
/in/ex6.cpp:82:9: error: redeclaration of 'int depthOfTree'
     int depthOfTree = 1 + std::max(leftDepth, rightDepth)
         ^~~~~~~~~~~
/in/ex6.cpp:68:9: note: 'int depthOfTree' previously declared here
     int depthOfTree, leftDepth, rightDepth;
         ^~~~~~~~~~~
/in/compile/Makefile:69: recipe for target 'ex6.o' failed
make: *** [ex6.o] Error 1

Information

Submit By
Type
Submission
Homework
Exercise 6
Language
C++
Submit At
2024-12-22 19:11:59
Judged At
2024-12-22 19:11:59
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes