帮忙修改c++

来源:百度知道 编辑:UC知道 时间:2024/05/27 20:06:27
// Note:Your choice is C++ IDE
#include <iostream.h>
#include <stdio.h>
struct node{
int val;
node *next;
};
class linklist{
node *head;
int size;
public:
linklist(){head=0;size=0;}
void clear();
void putTail(int newdata);
int gethead();
int getElemCount();
~linklist(){clear();}
};

class queue:public linklist{
int q[100];
int sloc,rloc ;
public :
queue();
void qput( int i ) ;
void putTail(int newdata);
int gethead(void);
int getElemCount();
void getdata(int newdata);
}
void linklist::putTail(int i)
{
node *r,*t,*e;
if(head)
{
r=head;
t=head->next;
while(t!=0)
{
r=t;
t=t->next;
}
e=new node; //为e结点分

// Note:Your choice is C++ IDE
#include <iostream.h>
#include <stdio.h>
struct node{
int val;
node *next;
};
class linklist{
node *head;
int size;
public:
linklist(){head=0;size=0;}
void clear();
void putTail(int newdata);
int gethead();
int getElemCount();
~linklist(){clear();}
};

class queue:public linklist{
int q[100];
int sloc,rloc ;
public :
queue();
void qput( int i ) ;
void putTail(int newdata);
int gethead(void);
int getElemCount();
void getdata(int newdata);
}
void linklist::putTail(int i)
{
node *r,*t,*e;
if(head)
{
r=head;
t=head->next;
while(t!=0)
{
r=t;
t=t->next;
}
e=new node; //为e结点分配存储
e->val=i;
e->next=NULL;
if(e!=0)
t->next=e;
cout<<e<<endl;
}