Hello, I've ran into a problem with my header file. I can't figure out what's wrong with my keyedItem class. It looks like keyedItem is the main problem for not my program. Any suggestions? Thanks for reading.
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
Usually for C/C++ header file we have include guard to prevent the same .h file being included multiple times leading to those multiply defined problem when we have a C++ project consisting of a lot of files.
sweet jesus! , awesome, it works I'm not really sure why it works though, but thanks a lot...but I've ran into another problem =/ my insertItem function is not working.
void binarySearchTree::insertItem(treeNode *&treePtr,const keyedItem &newItem)
{
if(treePtr==NULL)
treePtr=new treeNode(newItem,NULL,NULL);
else if(newItem.getKey()<treePtr->item.getKey()) //newItem.getKey() doesn't seem to work
insertItem(treePtr->left,newItem);
else
insertItem(treePtr->right,newItem);
Please do not bring up "teacher's code" etc in this forum. Previously a guy also post his teacher sample code and it was being criticised as not conforming to standard C++. In the end he was asked to take his post down and "reprimanded" by his teacher.
Please note teacher do surf Internet too. If you want help, please leave "teacher's code" etc this phrase out of your posting else soon you will get no help and a fail grade even!