C++高手速进!

来源:百度知道 编辑:UC知道 时间:2024/06/04 04:43:44
实现C/C++函数:创建一个单链表和显示该单链表,单链表的每个结点有两个域:信息域data和指针域link。另设计函数main调用这两个函数完成单链表的建立和打印工作。
答的好加分!!!!!!!!!!!!
希望运行成功后给我!

#include <iostream>
using namespace std;
struct student
{
int no;
char name[10];
student *next;
};

void chaxun(student *pl)
{
while(pl->next!=NULL)
{
cout<<pl->no<<endl
<<pl->name<<endl;
pl=pl->next;
}

}

student *charu()
{
student *pl;
pl=new student;
cout<<"输入NO"<<endl;
cin>>pl->no;
cout<<"输入NAME"<<endl;
cin>>pl->name;
return pl;
}

int main()
{
int no=0;
student *p=NULL,*head=NULL;
cout<<"***************************************"<<endl;
cout<<"* 1.插入学生信息"<<endl;