How to run this souce code.... I don't know if how I will have to revise.
visual studio 2010\projects\binarysearchtree\binarysearchtree\binarytree.h(7): error C2143: 구문 오류 : ';'이(가) '<' 앞에 없습니다.
visual studio 2010\projects\binarysearchtree\binarysearchtree\binarytree.h(7): error C2059: 구문 오류 : '<'
visual studio 2010\projects\binarysearchtree\binarysearchtree\binarytree.h(8): error C2143: 구문 오류 : ';'이(가) '{' 앞에 없습니다.

#ifndef BST_H_
#define BST_H_

#include<iostream>
using namespace std;
#include "BinaryTree.h"
#include "NonexistentElement.h"
#include "BoundaryViolation.h"


template<typename K, typename V>
class Entry
{
public:
    typedef K Key;
    typedef V Value;
public:
    Entry(const K& k = K(), const V& v = V())
        :_key(k), _value(v){}
    const K& key() const{return _key};
    const V& value() const{return _value};
    void setKey(const K& k){_key = k;};
    void setValue(const V& v){_value = v;};
private:
    K _key;
    V _value;
};
template<typename E>
class SearchTree
{
public:
    typedef typename E::Key K;
    typedef typename E::Value V;
    class Iterator;
public:
    SearchTree();
    int size() const;
    bool empty() const;
    Iterator find(const K& k);
    Iterator insert(const K& k, const V& x);
    void erase(const K& k) throw(NonexistentElement);
    void erase(const Iterator& p);
    Iterator begin();
    Iterator end();
protected:
    typedef BinaryTree<E> BinaryTree;
    typedef typename BinaryTree::Position TPos;
    Tpos root() const;
    TPos finder(const K& k, const TPos& x);
    TPos inserter(const K& k, const V& x);
    TPos eraser(TPos& v);
    TPos restructure(const TPos& v)
        throw(BoundaryViolation);
private:
    BinaryTree T;
    int n;
public:
    class Iterator
    {
    private:
        TPos v;
    public:
        Iterator(const TPos& vv) : v(vv){}
        const E& operator*() const
        {
            return *v;
        }
        E& operator*() 
        {
            return *v;
        }
        bool operator==(const Iterator& p) const
        {
            return v == p.v;
        }
        Iterator& operator++();
        friend class SearchTree;
    };
};
template<typename E>
typename SearchTree<E>::Iterator& SearchTree<E>::Iterator::operator++()
{
    TPos w = v.right();
    if(w.isInternal())
    {
        do
        {
            v = w;
            w= w.left();
        }
        while(w.isInterna());
    }
    else
    {
        w = v.parent();
        while(v == w.right())
        {
            v = w;
            w = w.parent();
        }
        v = w;
    }

    return *this;
}
template<typename E>
SearchTree<E>::SearchTree() : T(), n(0)
{
    T.addRoot();
    T.expandExternal(T.root());
}
template<typename E>
typename SearchTree<E>::TPos root() const
{
    return T.root().left();
}
template<typename E>
typename SearchTree<E>::TPos SearchTree<E>::finder(const K& k, const TPos& v)
{
    if(v.isExternal())
        return v;
    if(K < v -> key())
        return finder(k, v.left());
    else if(v -> key() < k) 
        return finder(k, v.right());
    else 
        return v;
}
template<typename E>
typename SearchTree<E>::Iterator SearchTree<E>::find(const K& k)
{
    TPos v= finder(k, root());
    if(v.isInternal())
        return Iterator(v);
    else 
        return end();
}
template<typename E>
typename SearchTree<E>::TPos SearchTree<E>::inserter(const K& k, const V& x)
{
    TPos v = finder(k, root());
    while(v.isInternal())
        v = finder(k, v.right());
    T.expandExternal(v);
    v -> setKey(k);
    v -> setValue(x);
    n++;
    return v;
}
template<typename E>
typename SearchTree<E>::Iterator insert(const K& k, V& x)
{
    TPos v = inserter(k, x);
    return Iterator(v);
}
template<typename E>
typename SearchTree<E>::Tpos inserter(const K& k, const V& x)
{
    Tpos v = finder(k, root());
    while(v.isInternal())
        v = finder(k, v.left());
    T.expandExternal(v);
    v -> setKey(k);
    v -> setValue(x);
    n++;
    return v;
}
template<typename E>
typename SearchTree<E>::Iterator SearchTree<E>::insert(const K& k, const V& x)
{
    Tpos v = inserter(k, x);
    return Iterator(v);
}
template<typename E>
typename SearchTree<E>::TPos SearchTree<E>::eraser(TPos& v)
{
    TPos w;
    if(v.left().isExternal()) 
        w = v.left();
    else if( v.right().isExternal())
        w = v.right();
    else
    {
        w = v.right();
        do
        {
            w = w.right();
        }
        while(w.isInternal());
        TPos u = w.parent();
        v -> setKey(u -> key());
        v -> setValue(u -> value());
    }
    n--;
    return T.removeAboveExternal(w);
}
template<typename E>
void SearchTree<E>::erase(const K& k) throw(NonexistentElement)
{
    TPos v = finder(k, root());
    if(v.isExternal())
        throw NonexistentElement("Erase of nonexistent");
    eraser(v);
}
template<typename E>
void SearchTree<E>::erase(const Iterator& p)
{
    eraser(p.v);
}
template<typename E>
typename SearchTree<E>::Iterator SearchTree<E>::begin()
{
    TPos v = root();
    while(v.isInternal())
        v = v.left();
    return Iterator(v.parent());
}
template<typename E>
typename SearchTree<E>::Iterator SearchTree<E>::end()
{
    return Iterator(T.root());
}
#endif



#ifndef BINARYTREE_H_
#define BINARYTREE_H_

typedef int Elem;

template<typename E>
class BinaryTree<E>
{
protected:
    struct Node
    {
        Elem elt;
        Node* par;
        Node* left;
        Node* right;
        Node():elt(), par(NULL), left(NULL), right(NULL){}
    };
public:
    class Position
    {
    private:
        Node* v;
    public:
        Position(Node* _v = NULL) : v(_v){}
        Elem& operator*()
        {
            return v -> elt;
        }
        Position left() const
        {
            return Position( v -> left);
        }
        Position right() const
        {
            return Position( v -> right);
        }
        Position parent() const
        {
            return Position( v -> par);
        }
        bool isRoot() const
        { 
            return v -> par == NULL;
        }
        bool isExterna() const
        {
            return v -> left == NULL && v -> rigth == NULL;
        }
        friend class BinaryTree;
    };
    typedef std::list<Position> PositionList;
public:
    BinaryTree();
    int size() const;
    bool empty() const;
    Position root() const;
    Position position() const;
    void addRoot();
    void expandExternal(const Position & P);
    Position removeAboveExternal(const Position& p);
private:
    Node* _root;
    int n;
};
#endif

Assuming this is a C++ library API, you either instantiate an object directly with new or call factory static methods that return an object instance. You have to read the docs or code to figure out how to use it. Of course, you need to #include the header(s), tell make and ld/ld() where the static/dynamic libraries are.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.