node.h
#ifndef _NODE_H_
#define _NODE_H_
#include<iostream>
template<typename ElemType>
class node
{
public:
ElemType data;
node<ElemType>* next;
//construct
node();
node( ElemType e,node<ElemType>* link =NULL);
};
template<typename ElemType>
node<ElemType>::node()
{
next=NULL;
}
template<typename ElemType>
node<ElemType>::node( ElemType e,node<ElemType>* link)
{
data=e;
next=link;
}
#endif
1.h //linklist.h
#ifndef _1_H_
#define _1_H_
#include "node.h"
#include <assert.h>
#include<iostream>
using namespace std;//error: ‘cout’ was not declared in this scope
template<typename ElemType>
class LinkList
{
int length;
node<ElemType>* head;
public:
LinkList();
LinkList(ElemType v[],int n);
bool LocateElem(const ElemType e,int &count);
void traverse( void(*view)(ElemType&