书上没介绍有动态的链表,MSDN也没怎么介绍
在下面的静态链表中怎样实现 添加和删除功能?
#include<iostream>
#include<string>
using namespace std;
struct Student{
int num;
string name;
float score;
Student *next;
};
int main()
{
Student stu[3],*head,*p;
stu[0].num=31001; stu[0].name="li"; stu[0].score=80;
stu[1].num=31002; stu[1].name="che"; stu[1].score=85;
stu[2].num=31003; stu[2].name="wang"; stu[2].score=90;
head=stu;
stu[0].next=&stu[1];
stu[1].next=&stu[2];
stu[2].next=NULL;
p=head;
do{
cout<<p->num<<' '<<p->name<<' '<<p->score<<endl;
p=p->next;
}
while(p!=NULL);
return 0;
}
[此贴子已经被作者于2007-8-9 17:02:38编辑过]