哪位高手能帮我 编写一个逐个输出单链表中所有数据元素的成员函数?急求!

来源:百度知道 编辑:UC知道 时间:2024/06/22 19:29:41
我只要逐个输出单链表中所有数据元素的成员函数的 程序就可以啊? 这么长不知道 哪个是啊?谢谢!!

这个程序主要是单链表的操作!
#include<iostream>
#include<iomanip>
using namespace std;
struct node{
double data;
struct node *next;
};

struct node *create();
struct node *rescreate();
void printlist(struct node *head);
int len(struct node *head);
void insertnode(struct node *head,int i,double x) ;
void delnode(struct node *head,double x);
void delnode2(struct node *head,int i);
void sort(struct node *head);

int main()
{
struct node *p;
p=rescreate();
printlist(p);
//cout<<endl<<len(p)<<endl;
insertnode(p,3,-100);
cout<<endl;
printlist(p);

delnode2(p,4);
cout<<endl;
printlist(p);

sort(p);
cout<<endl<<"After sort\n";
printlist(p);

system("pause");
return 0;
}

struct node *create()