这个学生管理系统是通过单链表实现的,这个管理系统是为了让我们更好得对链表进行操作。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
struct Node
{
char name[10];
int num;
int age;
struct Node* next;
};
//创建一个学生链表
struct Node* createlist()
{
struct Node* list = (struct Node*)malloc(sizeof(struct Node));//给list分配一个内存空间
list->next = NULL;
return list;
}
//创建一个学生的结点
struct Node* createnode(char *newname, int newnum, int newage)
{
struct Node* node = (struct Node*)malloc(sizeof(struct Node)); //给结点分配一个内存空间
strcpy(node->name, newname); //把信息放到结点中
node->age = newage;
node->num = newnum;
node->next = NULL;
return node;
}
//在尾部插入一个学生的信息
void insertback(struct Node* list, char *newname, int newnum, int newage)
{
struct Node* newnode = createnode(newname, newnum, newage);
//找到尾结点
struct Node* temp = list;//移动的结点用来找到尾结点
while (temp->next != NULL) //一直移动到最后一个结点
{
temp = temp->next;
}
newnode->next

本文介绍了一个使用单链表实现的学生管理系统,包括创建、插入、删除、查找和打印学生信息的功能,并提供完整的C语言源代码。

7371

被折叠的 条评论
为什么被折叠?



