cout undeclared?

This is my header file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef TREE_H
#define TREE_H
namespace BSTree
{

	class SearchTree; //forward declaration


	class TreeNode
	{
	public:
		TreeNode();
		TreeNode(int theData, TreeNode* left, TreeNode* right)
			: data(theData), leftLink(left), rightLink(right){}
		friend class SearchTree;
	private:
		int data;
		TreeNode *leftLink;
		TreeNode *rightLink;
	};


	class SearchTree
	{
	public:
		SearchTree() : root(NULL){}
		virtual ~SearchTree();
		void insert(int item); //Adds item has been added to the tree.
		bool inTree(int item) const;
		void inOrderShow() const;
	private:
		void insert(int item, TreeNode*& subTreeRoot);
		bool inTree(int item, TreeNode* subTreeRoot) const;
		void deleteSubtree(TreeNode*& subTreeRoot);
		void inOrderShow(TreeNode* subTreeRoot) const;
		TreeNode*root;
	};

} //BSTree

#endif 

This is my cpp file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include "Tree.h"

namespace BSTree
{

	void SearchTree::insert(int item, TreeNode*& subTreeRoot)
	{
		if (subTreeRoot == NULL)
			subTreeRoot = new TreeNode(item, NULL, NULL);
		else if (item < subTreeRoot->data)
			insert(item, subTreeRoot->leftLink);
		else //item >= subTreeRoot->data
			insert(item, subTreeRoot->rightLink);
	}


	void SearchTree::insert(int item)
	{
		insert(item, root);
	}


	bool SearchTree::inTree(int item, TreeNode* subTreeRoot) const
	{
		if (subTreeRoot == NULL)
			return false;
		else if (subTreeRoot->data == item)
			return true;
		else if (item < subTreeRoot->data)
			return inTree(item, subTreeRoot->leftLink);
		else //item >= link->data
			return inTree(item, subTreeRoot->rightLink);
	}


	bool SearchTree::inTree(int item) const
	{
		return inTree(item, root);
	}


	void SearchTree::inOrderShow(TreeNode* subTreeRoot) const
	{
		if (subTreeRoot != NULL)
		{
			inOrderShow(subTreeRoot->leftLink);
			cout << subTreeRoot->data << " ";
			inOrderShow(subTreeRoot->rightLink);
		}
	}

	void SearchTree::inOrderShow() const
	{
		inOrderShow(root);
	}


	void SearchTree::deleteSubtree(TreeNode*& subTreeRoot)
	{
		if (subTreeRoot != NULL)
		{
			deleteSubtree(subTreeRoot->leftLink);

			deleteSubtree(subTreeRoot->rightLink);

			//subTreeRoot now points to a one node tree.
			delete subTreeRoot;
			subTreeRoot = NULL;
		}
	}


	SearchTree::~SearchTree()
	{
		deleteSubtree(root);
	}
};//BSTree 


I'm having trouble figuring out why my code isnt working. The only error im getting is that my cout is undefined.
Error 1 error C2065: 'cout' : undeclared identifier tree.cpp 50
Error 2 error C2065: 'cout' : undeclared identifier tree.cpp 50
3 IntelliSense: identifier "cout" is undefined tree.cpp 50

Note:i had class templates before i ran my code and it ran fine
please help


std::cout
i tried that and it gives me a huge junk of errors that pertains inside my .exe file and .obj files
and...the errors are?
Topic archived. No new replies allowed.