教务管理系统(链表)

博主隐匿269介绍如何用链表构建教务管理系统。系统通过多个链表相互连接,主要包含两个核心链表,分别存储具体的数据和指向其他链表的指针。
摘要由CSDN通过智能技术生成

大家好,我是作者:隐匿269今天我带来的是用链表制作教务管理系统。教务管理系统呢,其实就是一个个链表互相指向,所组成的链表网。我们只需要创建两个链表就行了,一个是具体数据,一个指向另一个链表。


 


 

 

 

#include"Link.h"
#include <iostream>
#include <string>
#include<math.h>
using std::string;
using std::cin;
using std::cout;
using std::endl;
//创建链表
L*init_link()
{
	L*temp = new L;
	//判断
	if (temp == NULL)
	{
		cout << "空间申请失败!" << endl;
		return 0;
	}
	temp->head = NULL;
	temp->next = NULL;
	return temp;
}

//创建节点
S*init_student()
{
	S*temp = new S;
	//判断
	if (temp == NULL)
	{
		cout << "空间申请失败!" << endl;
		return 0;
	}
	temp->name = "";
	temp->num = 0;
	temp->age = 0;
	temp->language = 0;
	temp->mathematics = 0;
	temp->English = 0;
	temp->Physics = 0;
	temp->Chemistry = 0;
	temp->biology = 0;
	temp->Politics = 0;
	temp->history = 0;
	temp->Sports = 0;
	temp->Total_score = 0;
	temp->average = 0;
	temp->next = NULL;
	return temp;
}

//创建临时节点,
S*init_student(string name1, int num, int age, double language, double mathematics, double English, double Physics, double Chemistry, double biology, double Politics, double history, double Sports)
{
	S*temp = init_student();
	temp->name = name1;
	temp->num = num;
	temp->age = age;
	temp->language =language;
	temp->mathematics = mathematics;
	temp->English = English;
	temp->Physics = Physics;
	temp->Chemistry = Chemistry;
	temp->biology = biology;
	temp->Politics = Politics;
	temp->history = history;
	temp->Sports = Sports;
	temp->Total_score = temp->language + temp->mathematics + temp->English + temp->Physics + temp->Chemistry + temp->biology + temp->Politics + temp->history + temp->Sports;
	temp->average = temp->Total_score / 9;
	return temp;
}

//插入节点(尾插)
void Add_head(L*a,string name1, int num, int age, double language, double mathematics, double English, double Physics, double Chemistry, double biology, double Politics, double history, double Sports)
{
	//判断
	if (a == NULL)
	{
		cout << "插入失败!" << endl;
		return;
	}
	else if (a->head == NULL)
	{
		a->head = new S;
		//创建临时节点
		S*temp = init_student(name1,num, age,language,mathematics,English,Physics,Chemistry,biology,Politics,history,Sports);
		a->head->next = temp;
	}
	else
	{//创建临时节点
		S*temp = init_student(name1, num, age, language, mathematics, English, Physics, Che
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秘密之乡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值