C语言单链表的问题 急急急!!!

来源:百度知道 编辑:UC知道 时间:2024/05/18 22:14:19
某班有10名学生 ,建立单链表,每个结点包括:学号、姓名、性别、年龄。输出学生名单,查找某个学生在单链表中的序号。输入一个学号,如果链表中的结点所包含的学号不等于该学号,则进行插入操作 用C语言编写,哪位帮帮我啊
高分请老师啊,我太懒了

这个书上有例子,你也太懒了吧..
而且分数那么少,哪个愿意帮你写

#include<stdio.h>
#include<malloc.h>
typedef struct student{
long lNumber;
char cName[20];
char iSex;
int iAge;
struct student *next;
}student;

void main()
{
student *head,*p,*q;
long num;

int n=0;
p=(student *)malloc(sizeof(student));
scanf("%ld%s%c%d",&p->lNumber,&p->cName,&p->iSex,&p->iAge);
q=p;
while ( p!=0 )
{
n++;
if (n==1)
{
head=p;
}
q=p;
p=p->next;
p=(student*)malloc(sizeof(student));
printf("please input the %d student's information:\n");
scanf("%ld%s%c%d",&p->lNumber,&p->cName,&p->iSex,&p->iAge);
}//输入学生的信息
p->next = NULL;
printf("now seek the student\n");//以下是用来查找该学生的
p=head->next;
n=1;
scanf("%ld",&