surreal5335
07-23-2010, 04:24 AM
I am trying to create a binary search tree. My problem is I cant find any real good resources on what is required to declare it or how it works. All I can find is long pages of code that is not explained at all.
From a book I have read, thia is what I have created for it:
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main() {
int searchInt;
int treeArray[] = {35, 18, 48, 72, 60, 25};
int arraySize = sizeof(treeArray)/sizeof(int);
stree<int> t (treeArray, treeArray+arraySize);
cout << t.size();
cout << "Please enter your number to be searched in the tree: ";
cin >> searchInt;
cout << "\n";
system("PAUSE");
} // end main
Here is the errors I am getting on it:
C:\Documents and Settings\ben\Desktop\park\c++>g++ week7Prog.cpp
week7Prog.cpp: In function `int main()':
week7Prog.cpp:15: error: `stree' was not declared in this scope
week7Prog.cpp:15: error: expected primary-expression before "int"
week7Prog.cpp:15: error: expected `;' before "int"
week7Prog.cpp:17: error: `t' was not declared in this scope
I appreciate any help in the matter
From a book I have read, thia is what I have created for it:
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main() {
int searchInt;
int treeArray[] = {35, 18, 48, 72, 60, 25};
int arraySize = sizeof(treeArray)/sizeof(int);
stree<int> t (treeArray, treeArray+arraySize);
cout << t.size();
cout << "Please enter your number to be searched in the tree: ";
cin >> searchInt;
cout << "\n";
system("PAUSE");
} // end main
Here is the errors I am getting on it:
C:\Documents and Settings\ben\Desktop\park\c++>g++ week7Prog.cpp
week7Prog.cpp: In function `int main()':
week7Prog.cpp:15: error: `stree' was not declared in this scope
week7Prog.cpp:15: error: expected primary-expression before "int"
week7Prog.cpp:15: error: expected `;' before "int"
week7Prog.cpp:17: error: `t' was not declared in this scope
I appreciate any help in the matter