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

📄 liststudent.h

📁 增加学生信息、删除学生信息、修改学生信息 查询时可实现按姓名查询、按学号查询; 能对用户指定的任意课程名
💻 H
字号:
#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);
        void find_chinese(int score);
		void find_math(int score);
		void find_english(int score);
		Linkstudent * get_first();
		bool empty()const{ 

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

      

		void show_all()const;

public:
	void read_stuInfo();//从文件studentInfo.txt中读数据
	void save_stuInfo();//保存数据到文件studentInfo.txt
	void sort_descending(int choice);  //升序排序
	int get_size();  //获得列表大小
	void sort_ascending(int choice);  //降序排序
};
#endif

⌨️ 快捷键说明

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