连接错误2001
#ifndef DOG#define DOG
struct Node
{
int info;
Node *next;
};
class Clist
{
public:
Clist()
{
head=NULL;
}
void insert(int a,int b);
void deletelist(int a);
void output();
private:
Node *head;
int a,b;
};
#endif
头文件
#include<iostream>
#include"List.h"
using namespace std;
void Clist::insert(int a,int b)
{
Node *p,*q,*s;
s=(Node*)new(Node);
s->info=b;
p=head;
if(head==NULL)
{
head=s;
s->next=NULL;
}
else if(p->info==a)
{
s->next=head;
head=s;
}
else
while(p->info!=a&&p->next!=NULL)
{
q=p;
p=p->next;
}
if(p->info==a)
{
q->next=s;
s->next=p;
}
else
{
p->next=s;
s->next=NULL;
}
}
void Clist::deletelist(int a)
{
Node *p,*q;
p=head;
if(p==NULL)
return;
if(p->info==a)
{
head=p->next;
delete p;
}
else
{
while(p->info!=a&&p->next!=NULL)
{
q=p;
p=p->next;
}
if(p->info==a)
{
q->next=p->next;
delete p;
}
}
}
这是函数实现
#include<iostream>
#include"List.h"
using namespace std;
int main()
{
int m[]={11,12,13,14,15,16,17,18,19,20},i;
Clist obj1,obj2;
obj1.insert(0,m[0]);
for(i=0;i<10;i++)
obj1.insert(0,m[i]);
obj1.output();
return 0;
}
这是主函数
通过调试了,通不过编译,请大家帮忙看看,,,,,,,,,,,,,,,,,,,