⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.cpp

📁 1.管理信息系统(学生成绩) 两种用户等级:管理员和用户
💻 CPP
字号:
#include "Function.h"


/**************
构造函数
***************/
InfoManager::InfoManager()
{
	head_stu=NULL;
	head_tea=NULL;
	InfoManager::Load();
}

InfoManager::~InfoManager()//析构函数
{
	Unit *p,*q;
	p=head_stu;
	while (p)
	{
		p=p->next;
		delete head_stu;
		head_stu=p;
	}
	head_stu=NULL;
	q=head_tea;
	while (q)
	{
		q=q->next;
		delete head_tea;
		head_tea=q;
	}
	head_tea=NULL;
}

int InfoManager::GetAuthority(Unit * ptr)
{
	int auth=ptr->Authority;
	return auth;
}



int InfoManager::Get_Length ()
{
	int count=1;
	Unit *p;
	p=head_stu;
	while (p->next)
	{
		++count;
		p=p->next;
	}//计算节点数
	return count;
}

Unit * InfoManager::Get_Head (int i)
{
	if (i==0) return head_stu;
	return head_tea;
}

int InfoManager::Get_ptr(Unit *&ptr,long ID)
{
	//查找结点
	ptr=NULL;
	Unit *p1=head_stu;
	Unit *p2=head_tea;
	while (p1)
	{
		if (p1->ID==ID) break;
		else p1=p1->next;
	}
	ptr=p1;
	if (!p1)
	{
		while (p2)
		{
			if (p2->ID==ID) break;
			else p2=p2->next;
		}
		ptr=p2;
	}
	if (!p1&&!p2) return 0;
	else return 1;
}
			

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -