编程高手进!我错在哪里?

来源:百度知道 编辑:UC知道 时间:2024/06/07 13:34:57
G:\11.cpp(102) : fatal error C1075: end of file found before the left brace '{' at 'G:\11.cpp(59)' was matched
执行 cl.exe 时出错.
因为源程序不可以全发在页面上
希望高手E-mail 联系 上面解决 很着急 E-mail:jingjing55220475@sina.com

程序中的花括号没有匹配,查一查哪里的}少了。还有部分分号多了少了也会把花括号给屏蔽了。还要查一查有没有函数定义时多出了分号如fun();{}

把源程序发上来让人看才能说出真正的错误。不过这样也好,自已查程序才会有进步

//程序改好了,编译通过,我没数据,就不测试了
//我想说,兄台,你太太太粗心了,好多是错别字!

//修改后的程序:
#include<iostream>
using namespace std;

template<typename T>
struct node
{
T data;
node<T> *next;
};

template<typename T>
class linklist
{
public:
linklist(T a[],int n);
~linklist();
void Insert(int i,T x);
T Delete(int i);
int Locate(T x);
void Printlist();
private:
node<T> *first;
};

template<typename T>
linklist<T>::linklist(T a[],int n)
{
//node<T> *first; //这里不能再定义这个first,这是类的成员
first=new node<T>;
first->data=a[0];//这句我加的.
first->next=NULL;
node<T> *s;//这里有问题,我把它调到循环外了.
for(int i=1;i<n;i++)//init i=1
{
s=new node<T>;
s->