#include
#include
#include
#include
#define NUll
#define LEN sizeof(struct student)
struct student
{
int number;
char name[];
float score;
struct student *next;
};
/*函数说明*/
struct student * creat(); /*创建链表*/
void print(struct student *head); /*输出学生信息*/
struct student *add(struct student *head); /*添加学生信息*/
struct student * sort(struct student *head); /*对学生信息进行排序*/
struct student * insert(struct student *head); /*插入学生信息*/
struct student * del_num(struct student *head); /*删除学生信息*/
void search(struct student *head); /*查找学生信息*/
struct student * change(struct student *head); /*修改学生信息*/
int n;
int main()
{
int num,x;
char a[];
struct student *head,*head,*head;
head=NUll;
A
printf(" 学生信息系统 n");
printf(".建立链表n");
printf(".添加学生n");
printf(".插入学生n");
printf(".删除学生n");
printf(".查找学生n");
printf(".修改学生n");
printf(".数据浏览n");
printf(".退出程序n");
printf("请选择操作(输入—):");
scanf("%d",&num);
switch(num)
{
case 母亲节作文600
head=creat();
break;
case
head=add(head);
head=sort(head);
print(head);
break;
case
head=insert(head);
head=sort(head);
print(head);
break;
case
head=del_num(head);
print(head);
break;
case
search(head);
break;
case
head=change(head);
print(head);
break;
case
print(head);
break;
case
return ;
default
printf("输入错误的数字!!请再输一次!n");
}
goto A;
scanf("%d",&x);
return ;
新年愿望作文}
//创建链表
struct student * creat()
{
struct student *head,*p,*p;
n=;
head=(struct student*)malloc(LEN);
if(head!=NULL)
{
printf("空链表已建立!n");
}
else
{
printf("没有足够的内存空间!n");
}
head>number=;
strcpy(head>name,"");
head>score=;
return head;
}
//输出学生信息
void print(struct student *head)
{
struct student *p;
if(head==NULL)
{
printf("未建立链表!!n");
return;
}
p=head>next;
printf("n所有学生信息的显示为:n");
do
{高中日记
printf("学号:%dt姓名:%st分数:%.fn",p>number,p>name,p>score);
p=p>next;
}while(p!=NUll);
}
//添加学生信息
struct student *add(struct student *head)
{
struct student *p,*p;
if(head==NULL)
{
printf("未建立链表!!n");
return NULL;
}
p=head;
while()
{
p=(struct student *)malloc(LEN);
if(p==NULL)
{
printf("没有足够的空间!n");
return ;
}