Question
I have 2 Function : void AddElements(TreeType& tree, int info[], int fromIndex, int toIndex) { int midIndex; if (fromIndex void MakeTree(TreeType& tree, int info[], int
I have 2 Function :
void AddElements(TreeType& tree, int info[], int fromIndex, int toIndex)
{ int midIndex;
if (fromIndex
void MakeTree(TreeType& tree, int info[], int length) // Creates a binary tree from a sorted array. { tree.MakeEmpty(); AddElements(tree, info, 0, length-1); }
So I want to read int array from text file and put to info[] like this: content text file: IsEmpty
PutItem P
PutItem F
PutItem S
PrintTree
MakeTree -100, -97 -23 -44 -69 -67 -55 -67 -9 -13 -9 -3 8 32 59 70 22 28 33 41 89 79 24 39 85
invoke in main.CPP :
else if (command == "MakeTree") {
int length=25; int ar[length]; for(int i=0;i inFile>>ar[i];
}
tree.MakeTree(tree,ar,length);
}
But I get an error, anybody can help me for doing this assignment?
152 153 154 else if command "Print Ancestors") 155 E 156 157 158 outFile> arr [i] 172 173 174 175 176 t ree MakeTree (tree, ar, 25) 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 Logs & others Code: Blocks x Search results x L Cccc x Build log x Build messages x CppCheck x CppCheck messages x Cs File L. Message Build Debug in cpppds ch8 recursive tree compiler GNU GCC Compiler) obj\Debug In function 'main' C:\Users 176 undefined reference to Tree Type Make Tree (TreeTyp & int int e error: ld returned 1 exit status Build failed 2 error (s 0 warning (s 0 minute (s 2 second (s)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started