I don't think this is the issue you are having, but might come back to bite you down the road.
Your display function takes an
ostream& argument
out. Ostensibly, you intend to write your output to that stream. However, you ignore
out and write everything to
cout (I assume you have a
using namespace std; statement at the beginning of your file, and you mean
std::cout).
1 2 3 4 5 6 7 8 9 10
|
void DB::display(ostream& out)
{
printHeader(cout);
Node* temp = front;
while (temp!= NULL)
{
temp->emp->display(cout);
temp = temp->next;
}
}
|
The reason you would pass an
ostream& to the function is to allow you to write the output to std::cout, std::cerr, a file, a particular piece of memory, another process, a socket, or any other stream you might come up with. Right now, the argument is being ignored. You should change
cout to
out in the body of your function.