注册 登录
编程论坛 C++教室

[求助]vs6C++这些空该怎么填啊?

drummer444 发布于 2007-07-09 08:58, 494 次点击

#include <iostream.h>
#include<iomanip.H>
struct LinkNode
{
int data;
LinkNode * next;
};
LinkNode *p,*t;

void CreateLink(LinkNode *h)
{
int k;
char c='y';
t=new LinkNode;
h->next=t;

while(c!='n')
{
cout<<"Please input interge:";
cin>>k;
____________________;
p=t;
t=new LinkNode;
p->next=t;
cout<<"Do you continuity(y/n):";
cin>>c;
}
__________________;
delete t;
}

void Traversal(LinkNode *h)
{
LinkNode *p;
p=h->next;
while(p!=NULL)
{
cout<<setw(5)<<p->data;
_____________________;
}
cout<<endl;
}

void mian()
{
LinkNode *l;
_____________________;
CreateLink(l);
_____________________;
}

2 回复
#2
Arcticanimal2007-07-09 11:27
以下是引用drummer444在2007-7-9 8:58:22的发言:

#include <iostream.h>
#include<iomanip.H>
struct LinkNode
{
int data;
LinkNode * next;
};
LinkNode *p,*t;

void CreateLink(LinkNode *h)
{
int k;
char c='y';
t=new LinkNode;
h->next=t;

while(c!='n')
{
cout<<"Please input interge:";
cin>>k;
t->data = k;
p=t;
t=new LinkNode;
p->next=t;
cout<<"Do you continuity(y/n):";
cin>>c;
}
cout<<"The End..."<<endl; //?[em02]
delete t;
}

void Traversal(LinkNode *h)
{
LinkNode *p;
p=h->next;
while(p!=NULL)
{
cout<<setw(5)<<p->data;
p = p->next ;
}
cout<<endl;
}

void mian()
{
LinkNode *l;
l = new LinkNode;
CreateLink(l);
Traversal( l );
}

#3
leeco2007-07-09 16:42
第二个空是p->next=NULL;
顺便说一下,你们老师写的代码一点没水准
1