C语言用链表实现学生管理系统

本文介绍了使用C语言创建一个链表来管理学生信息的系统,包括添加按学号排序的学生、遍历输出、查找及删除学生信息等功能。
摘要由CSDN通过智能技术生成

功能:

1.设计保存学生信息的链表

2. 可随时添加学生信息,将新加入的学生信息按学号顺序添加到链表中

3. 设计遍历输出函数

3. 设计查找函数,根据学号查找或姓名查找

5. 可随时删除学生信息,根据学号删除


#include"stdio.h"
#include"stdlib.h"
/*typedef struct student{
	int num;
	char name[20];
	int score;
	struct student *next;
}STU;*/    //用这一段的话struct student类型可用STU代替达到简写的作用

struct student{        //定义一个结构体student
	int num;
	char name[20];
	int score;
	struct student *next;
};
struct Node{           //结构体链表定义
	struct student data;
	struct Node* next;	
};

struct Node* creat_list(){   //创建一个链表的head结点
	struct Node* headNode=(struct Node*)malloc (sizeof(struct Node));
	headNode->next=NULL;
	return headNode;
}
struct Node* creat_Node(struct student data){    //把student对象转为链表的结点,好处是模板化,假如对象不是一个student类型只需要在这里改下就可以了
	struct Node* newNode=(struct Node*)malloc(sizeof(struct Node));
	newNode->data=data;
	newNode->next=NUL
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值