请问为什么在程序运行后却没有任何结果,还有为什么该类中除两个构造函数以外的其它函数都在左边的元素树中看不到?
#include<iostream.h>
#include<string.h>template<class T>class Sample
{
T a[100];
int n;
public:
Sample(){}
Sample(T* a,int n)
{
for(int i=0;i<n;i++)
Sample::a[i]=a[i];
}
int seek(T);
void display();
};template<class T>void Sample<T>::display()
{
for(int i=0;i<n;i++)
cout<<a[i]<<"  ";
cout<<endl;
}template<class T>int Sample<T>::seek(T c)
{
int low=0,high=n-1,mid;
while(low<=high)
{
mid=(low+high)/2;
if(a[mid]==c)
return mid;
else if(a[mid]<c) low=mid+1;
else high=mid-1;
}
return -1;
}void main()
{
char ch[]="abcdefghijk";
Sample<char> s(ch,11);
cout<<endl<<"元素序列:";s.display();
cout<<endl<<"元素g的下标:";s.seek('g');
cout<<endl;
}