liststudent.h

来自「用C++编的很好的学生管理系统的程序」· C头文件 代码 · 共 54 行

H
54
字号
#ifndef LISTSTUDENT_H_
#define LISTSTUDENT_H_
#include <iostream>
#include "linkstudent.h"
using namespace std;

class Liststudent
{
	private:
	Linkstudent *first;
	Linkstudent *tail;
	int size;

	void initial(){ first = tail = new Linkstudent; size = 0;}
	void removeall()
	{
		Linkstudent *temp;
		while(first != NULL)
		{
			temp = first;
			first = first->next;
			delete temp;

		}
		
		size = 0;
	}
	public:
		//constructor and destructor
		Liststudent(){ initial(); }
		~Liststudent(){ removeall();}
		void clear(){ removeall(); initial();}
		//add the student
		bool append(const Student &);
		bool insert(const Student &);//add to the front of the list
		//delete specific student  accooding to the name or snumber
		bool remove_n(char *n);
		bool remvoe_sn(char *sn);
		//find the student acoording to the name or snumber
		Linkstudent * find_n(char *n);
		Linkstudent * find_sn(char *sn);

		bool empty()const{ 

			if(first == tail) return true;
			else return false;
		}



		void show_all()const;

};
#endif

⌨️ 快捷键说明

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