Hello everyone. I'm writing a program that uses a binary tree to hold student info such as GPA, name and ID number, Problem is I've run into some issues with declarations and could use some help.
#include <iostream>
#include "Student.h"
#include "BinaryTree.h"
usingnamespace std;
int main()
{
int num = 0;
EmployeeInfo item;
BinaryTree<StudentInfo> tree;
cout << "Inserting nodes. ";
item.setID(2142);
item.setName("William Irving");
item.setGPA (3.41);
BinaryTree<EmployeeInfo>::TreeNode node;
node.value = item;
tree.insertNode(item);
// Display the Student List.
cout << "Here are the Students:\n\n";
tree.displayInOrder();
// Get an ID number to search for.
cout << "\nEnter the Student's number: ";
cin >> num;
// Search for the Student in the tree.
EmployeeInfo *ptr = tree.searchNode(num);
if (ptr)
{
cout << "Student was found:\n" << *ptr;
}
else
{
cout << "That Student was not found.\n\n";
}
system ("pause");
return 0;
}
I believe the issue lies in my Student.h but I can't seem to put a pin in what went wrong.
Edit: I'm using a binary tree header as well, but haven't included in due to length. I can provide it if necessary, but I tested it with another program and it seems to work fine.