prefacePretty boy I, as a helpful “good” senior, naturally to the school sister to do everything. When I was a sophomore, I excitedly applied for the guidance of a freshman class. As a handsome senior (attached photo), I soon got into a good relationship with three girls in our computer class, and boldly said, “If there is a problem, find a senior”.

I didn’t know it would start my three-year career as a tool man. But the three girls are very beautiful, hey hey. They are yellow hair primary school sister and northeast big sister and my hometown 170 little sister.

Soon to graduate, the original for the three school girls sorted out all kinds of things to share (at the beginning of their own learning, did not care).

When they were freshmen, they were the most enthusiastic, which made me forget the fact that I was still in engineering college. As the student score management system in the first semester of freshman year, they also had the biggest headache at that time. I sent them the course design I had made before.

Specific implementation of the use of c++, DOS interface, the use of technology is also a freshman, and there is no super outline, and I and yellow hair sister have taken full marks, suggested that there is a need for three key, collection again see ao! @TOC

An overview of the

Use C ++ or C language and other knowledge coding to achieve student achievement management system. Implement functions as required.

Course objective

The menu module, input module, query module, update module, output module, sorting module, statistics module, reasonable writing, in line with the students and teachers of the student performance management system of the basic use requirements, and on this basis to innovate, to achieve more functions. (Emphasis here, the teacher in order to encourage us to have innovation, focus on innovation points, so many students with color change, add character pictures and other magical sets to win the heart of the teacher) I was using the following figure, so that the teacher happily gave me five points of innovation points hahahaha.

Functional design

The system uses personas designed for teacher login and student login. (Later, I guided students to innovate, and added the role of administrator, and got the innovation points). When entering the system, there are two options:

Then select the role to enter, for the user experience, set the function of returning to the previous page (that is, return to the previous page).

File reading and writing, student class, course class, and student linked list techniques are used. (At this point in your freshman year, this list should impress your teachers.)

Teacher’s role

The function design of teacher role is as follows: 1. Login password verification 2. Input student information (name, student ID, gender, grade, school class) 3. Add student information 5. Find student information (index: name, student ID, school) 6. Delete student information 7. Modify student information 8. Sort (student NUMBER, single subject score, total score) 9. Calculation (total score, average score, pass rate)

The student role

Student role function design is less, ha ha ha, difficult to design a grade change function for you, heh heh.

Functional effect:

At that time, the focus and difficulty of learning C++ was the use of classes. However, my course was good at class design and use. I suggest that freshmen can refer to my implementation. Just a login, view information and score function.

Teacher’s role

Enter student information (name, student ID, gender, grade, school class)

Output student scores

Add Student information

Find student information (Index: Name, Student NUMBER, College)

Delete student information

Ranking (Student Number, Single subject score, total score)

Calculation (total score, average score, pass rate)

Public Curriculum (Add and delete courses)

The student role

File to read and write

1. Course information 2. Student information

The source code to

// Public courses can be set up, followed by individual electives
// Private course Settings are placed in the modification information...
// No file is available
// When the file is empty
#include<iostream>
#include<string>
#include<fstream>						// File output output stream operation
#include<iomanip>						// Align the output
using namespace std;
const char* filename = "Student.txt";			// The file name of the student information record
const char* filename_lesson = "Lesson.txt";	// Public course information record name
const int MAX = 10;							// Maximum number of courses

struct Lesson_Node// Class structure set {
	string L_name;							// Course name
	int grade;								// Course scores
};

class Lesson// Class {
private:
	Lesson_Node lesson[MAX];				// Course details, up to 10 items
	int n;									// The current number of courses
	int Mount_s;							//
	int Averg_s;							// Average grade
public:
	Lesson(a)// Class initialization, read the public course information Settings in the file, if there is no file to create a file
	{
		ifstream ifs(filename_lesson);
		if(! ifs) { string na[4] = { "Chinese"."Mathematics"."English"."Sports" };
			n = 4;
			for (int i = 0; i<n; ++i)
			{
				lesson[i].L_name = na[i];
				lesson[i].grade = 0;
			}
			SetA_M(a);Filein_PublicL(a);// If opening fails, write a file
		}
		else
		{
			ifs.close(a);Fileout_PbulicL(a);// Read the course Settings in the current file successfully}} -Lesson(a)/ / destructor
	{
		n = 0;
		Mount_s = 0;
		Averg_s = 0;
	}
	Lesson(const Lesson&rhs)				// Copy constructor
	{
		n = rhs.n;
		for (int i = 0; i<n; i++)
		{
			lesson[i].L_name = rhs.lesson[i].L_name;
			lesson[i].grade = rhs.lesson[i].grade;
			SetA_M(a); } } Lesson&operator= (const Lesson&rhs)
	{
		n = rhs.n;
		for (int i = 0; i<n; i++)
		{
			lesson[i].L_name = rhs.lesson[i].L_name;
			lesson[i].grade = rhs.lesson[i].grade;
			SetA_M(a); }return *this;
	}
	int ReturnMount_s(a)						// Returns the total score
	{
		return Mount_s;
	}
	int ReturnAverg_s(a)						// return the average score
	{
		return Averg_s;
	}
	void Dislesson(int x = 1)					// Outputs information about the current course
	{
		if (x == 1)							If x is not equal to 1, the modified course information in the current memory will be output
			Fileout_PbulicL(a);int i;
		for (i = 0; i<n; i++)
		{
			cout << i + 1 << lesson[i].L_name << "";
		}
		cout << endl;
	}
	void Addlesson(int i = 1)					// Add course parameter 1 is public course add 2 is private course add
	{

		char t = '1';
		string na;
		while (t == '1')
		{
			if (n == MAX)
			{
				cout << "To reach the course limit, no further additions can be made." << endl;
				return;
			}
			cout << Enter the name of the course to add:;
			cin >> na;
			lesson[n].L_name = na;
			if (i == 1)
				lesson[n].grade = 0;
			else
			{
				cout << "Input score";
				cin >> na;
				lesson[n].grade = atoi(na.c_str());
			}
			n++;							// The number of courses increases by 1

			cout << "Whether to continue to add courses :(1. Continue 0. No)";
			cin >> t;
		}
		if (i == 1)
			Filein_PublicL(a);// Write the modified course information to the file
	}
	void Dellesson(int i = 1)					// Delete the course
	{
		int x; string tmp; char t = '1';
		while (t == '1')
		{
			cout << "Please enter the course number to be deleted";
			cin >> tmp; x = atoi(tmp.c_str());
			if (x>0 && x <= n)
			{
				for (; x<n; x++)
				{
					lesson[x - 1].L_name = lesson[x].L_name;
					lesson[x - 1].grade = lesson[x].grade;
				}
				n--;
				if (i == 1)
					Dislesson(0);				// Display the course information in the current memory, to avoid the cycle of deletion, always read and write the file, so the modified course is written to the file once
			}
			else
			{
				cout << "Input error ~~~, or course information no longer exists" << endl;
			}
			cout << "Continue to delete course information (1. Yes, 0. No)";
			cin >> t;
		}
		if (i == 1)
			Filein_PublicL(a);// Write to the file
	}
	void SetA_M(a)							// Calculate the average and total scores
	{
		Mount_s = 0;
		for (int i = 0; i<n; i++)
		{
			Mount_s = Mount_s + lesson[i].grade;
		}
		Averg_s = Mount_s / n;
	}
	/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * individual elective curriculum * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
	void SetPersonLesson(a)
	{
		string tmp;
		char x = '0';
		int i;
		Dislesson(2);  cout << endl;                             // Outputs the course information in the current student information
		cout << "A. Add courses B. Delete courses";
		cin >> x;
		switch (x)
		{
		case 'a':Addlesson(2); break;							// Add a single course
		case 'b':Dellesson(2); break;							// Delete single-player courses
		default:
			i = x - '0';
			if (i>0 && i <= n)
			{
				cout << "Please enter" << lesson[i - 1].L_name << "Results:";
				cin >> tmp;
				lesson[i - 1].grade = atoi(tmp.c_str());// result from character to integer

			}
			break;
		}SetA_M(a); }/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * public curriculum part * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /

	void Filein_PublicL(a)				// Enter the public course Settings into the file
	{
		ofstream ofs(filename_lesson);
		if(! ofs) { cout <<"File opening failed" << endl;
			exit(0);
		}
		ofs << n << '\t';
		for (int i = 0; i<n; i++)
		{
			ofs << lesson[i].L_name << '\t';
		}
		ofs.close(a); }void Fileout_PbulicL(a)				// Read the public curriculum information from the file to create the course
	{
		int i = 0;
		ifstream ifs(filename_lesson);
		if(! ifs) { cout <<"File opening failed" << endl;
			exit(0);
		}
		ifs >> n >> ws;
		while(i<n && ! ifs.eof())			// Check whether the end of the file is read
		{
			ifs >> lesson[i].L_name >> ws;
			i++;
		}
		ifs.close(a); }void SetPbulicLesson(a)				// Set the current public course information
	{
		cout << "Current Public Course information:" << endl;// Display the current course information for easy use
		Dislesson(a); cout <<"1. Add course 2. Delete course 0.;
		string tmp; char t;
		cin >> t;
		switch (t)
		{
		case '1':
			Addlesson(a);break;
		case '2':
			Dellesson(a);break;
		case '0':break; }}friend istream& operator >> (istream& is, Lesson &rhs)// Enter the score
	{
		string tmp;
		for (int i = 0; i<rhs.n; i++)
		{
			cout << "Please enter" << rhs.lesson[i].L_name << "Results:";
			is >> tmp;
			rhs.lesson[i].grade = atoi(tmp.c_str());// result from character to integer
		}
		return is;
	}
	friend ostream& operator<<(ostream& os, Lesson &rhs)// Output the result
	{
		for (int i = 0; i<rhs.n; i++)
		{
			cout << "|" << rhs.lesson[i].L_name << "|\t " << rhs.lesson[i].grade << "\t";
		}
		cout << endl;
		return os;
	}
	friend class student_Node;
	friend class student_List;
};
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
Lesson L;/ / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * public class variables
class student_Node// Student information class, store student information, and modify the information {
private:
	string Name;		/ / name
	long Number;		/ / student id
	string Sex;			/ / gender
	string Academy;		/ / college
	string Class;		/ / class
	Lesson Less;        / / course
	student_Node *next;
public:
	student_Node(string na = "Empty".long num = 0, string sex = "Male", string aca = "Empty", string cla = "Empty")		// Initialize all members with grades and names. Need optimization?
		:Less(L)
	{
		SetName(na);
		SetNumber(num);
		SetSex(sex);
		SetAcademy(aca);
		SetClass(cla);
		next = NULL;
	}
	~student_Node(a)/ / destructor
	{
		Name = ""; Number = 0; Sex = ""; Academy = ""; Class = ""; next = NULL;
	}
	student_Node& operator= (const student_Node&rhs)
	{
		Name = rhs.Name;
		Number = rhs.Number;
		Sex = rhs.Sex;
		Academy = rhs.Academy;
		Class = rhs.Class;
		Less = rhs.Less;// Call the assignment function of the class
		return *this;
	}
	void SetName(string name)		// Set the name
	{
		Name = name;
	}
	void SetNumber(long num)		// Set the student id
	{
		Number = num;
	}
	void SetSex(string sex)			// Set gender
	{
		Sex = sex;
	}
	void SetAcademy(string acad)	// Set the college
	{
		Academy = acad;
	}
	void SetClass(string cla)		// Set the class
	{
		Class = cla;
	}
	void SetLesson(a)				// Single course
	{
		Less.SetPersonLesson(a); }friend istream& operator >> (istream&is, student_Node &rhs)// Enter data
	{
		string tmp;
		long num;
		cout << "Please enter name:";		// Enter the name in the temporary variable, and then set the name in the member by setting the function, the following is the same
		is >> tmp;
		rhs.SetName(tmp);
		cout << Please enter your student number:;
		is >> tmp;
		num = atol(tmp.c_str());		// Convert characters to long integers (fixed a bug when typing characters)
		rhs.SetNumber(num);
		cout << "Please enter gender:";
		is >> tmp;
		rhs.SetSex(tmp);
		cout << "Please enter college:";
		is >> tmp;
		rhs.SetAcademy(tmp);
		cout << "Please enter class:";
		is >> tmp;
		rhs.SetClass(tmp);
		is >> rhs.Less;				// Enter the course
		return is;
	}
	friend ostream& operator<<(ostream&os, student_Node &rhs)// Output data
	{
		cout << left << setw(8) << rhs.Name << left << setw(15) << rhs.Number << left << setw(8) << rhs.Sex << left << setw(10) << rhs.Academy << left << setw(10) << rhs.Class << left << setw(8) << rhs.Less.ReturnMount_s() << left << setw(8) << rhs.Less.ReturnAverg_s() << endl;

		cout << rhs.Less << endl;		// Output lessons
		return os;
	}
	friend class  student_List;		// Friend class Settings
};
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
class student_List// Student information list class, mainly for linked list operation, find output {
private:
	student_Node *head;
public:
	student_List(a)// Initialize the linked list, create a header, and read the information from the file to create the linked list
	{
		head = new student_Node;
		head->next = NULL;
		ifstream ifs(filename);
		if(! ifs)// If the file does not exist
		{
			Filewrite(a);// Create a file}} -student_List()
	{
		student_Node *p = head->next, *q;
		while(p ! =NULL)
		{
			q = p;
			p = p->next;
			delete q;
		}
		delete head;
	}
	void Fileread(a)					// Read the information in the file to create a linked list
	{
		ifstream ifs(filename);
		if(! ifs) { cout <<"File opening failed" << endl;
			exit(0);
		}
		student_Node *q = head;
		while (ifs.peek() != EOF)		Use this peek function instead of ifs.eof() to prevent loops when the file is empty
		{
			student_Node *p = new student_Node;
			ifs >> p->Name
				>> ws
				>> p->Number
				>> ws
				>> p->Sex
				>> ws
				>> p->Academy
				>> ws
				>> p->Class
				>> ws;
			ifs >> p->Less.n >> ws;
			for (int i = 0; i<p->Less.n; i++)
				ifs >> p->Less.lesson[i].L_name >> ws >> p->Less.lesson[i].grade >> ws;
			p->Less.SetA_M(a); q->next = p; p->next =NULL; q = p; }}void Filewrite(a)				// Write the contents of the linked list to the file by reading and writing the file
	{
		student_Node *p = head->next;
		ofstream ofs(filename);
		if(! ofs) { cout <<"File opening failed" << endl;
			exit(0);
		}
		while(p ! =NULL)
		{
			ofs << p->Name << '\t'
				<< p->Number << '\t' << p->Sex << '\t' << p->Academy << '\t' << p->Class
				<< endl;
			ofs << p->Less.n;
			for (int i = 0; i<p->Less.n; i++)
				ofs << '\t' << p->Less.lesson[i].L_name << '\t' << p->Less.lesson[i].grade;
			ofs << endl;
			p = p->next;
		}
		ofs.close(a); }/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * action part * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
	void Putin(int n = 1)			// The input parameter is different from the input of operation 1 The default is the input function
	{
		char x = '0';
		int i = 1;				/ / count
		int num_0, num_1;// Insert position
		student_Node *q;
		if (n == 1)				// This is required for operation input data, but not for insertion data
		{
			cout << "Clear original data 0. Yes 1. No, add in 3.;
			cin >> x;
			if (x == '1')// Add it
			{
				Fileread(a);// Read files to form a linked list
				Putin(0);				// The parameter change is the call of the insert function
				return; }}if (x == '0')
		{
			while (x == '0')
			{
				cout << i++ << endl;
				student_Node *p = new student_Node;
				cin >> *p;
				if(n ! =3)// Node insertion method
				{
					p->next = head->next;
					head->next = p;
				}
				else// Insert the node at any position
				{
					Display(2);
					cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -" << endl;
					cout << "Please select insert location:";
					cin >> x;
					num_0 = x - '0';
					q = head;
					num_1 = 0;// Find the location
					while(q->next ! =NULL)
					{
						num_1++;
						if (num_0 == num_1)
							break;
						q = q->next;
					}
					p->next = q->next;
					q->next = p;
					Display(2);
				}
				cout << "Do you want to continue? (0. Yes 1. No)";
				cin >> x;
				cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -" << endl;
			}
			Filewrite();
		}
	}
	void Display(int x = 1)				/ / display output cout < < < < setw left (40) < < "output" on the left < < < < setw left (35) < < "output" on the left < < endl;
	{
		if (x == 1)
			Fileread(a); cout << left <<setw(5) < <", serial number," << left << setw(8) < <"· Name · << left << setw(15) < <· Student Number · << left << setw(8) < <", gender," << left << setw(10) < <"College", << left << setw(10) < <", class," << left << setw(8) < <"| | total score" << left << setw(8) < <"Scored an average | |" << endl << endl;
		student_Node *p = head->next;
		int i = 1;
		while(p ! =NULL)
		{
			cout << left << setw(3) < <"" << left << setw(3) << i++ << "" << *p;
			p = p->next;
		}
		cin.get(a); cin.get(a); }void Insert(a)				// Insert (add)
	{
		Fileread(a);// Read files to form a linked list
		Putin(3);				// The parameter change is the call of the insert function

	}
	void Delete(a)				/ / delete
	{
		Find(2);
		Filewrite(a);// Write to the file
	}
	void Find(int i = 1)			/ / to find
	{
		Fileread(a);// Read files to form a linked list
		char x = '0';
		while (x == '0')
		{
			cout << "Select search method: 1. Name 2. Student Number 3.;
			cin >> x;
			switch (x)
			{
			case '1':
				Find_01name(i);
				break;
			case '2':
				Find_02number(i);
				break;
			case '3':
				Find_03academy(i);
				break;
			case '0':return;
			default:
				cout << "Wrong choice!!";
			}
			cout << "Do you want to continue?" 0.; cin >> x; }}void Find_01name(int x = 1)	// Find the name parameter 1. Find 2. Delete 3
	{
		int i = 0;
		string na;
		char x_0 = '1';
		student_Node *p = head->next, *q = head;
		cout << "Please enter the name you are looking for:";
		cin >> na;
		cout << left << setw(5) < <", serial number," << left << setw(8) < <"· Name · << left << setw(15) < <· Student Number · << left << setw(8) < <", gender," << left << setw(10) < <"College", << left << setw(10) < <", class," << left << setw(8) < <"| | total score" << left << setw(8) < <"Scored an average | |" << endl << endl;
		while(p ! =NULL)
		{
			if (p->Name == na)
			{
				cout << left << setw(3) < <"" << left << setw(3) << i++ << "" << *p;
				if (x == 2)// Delete data
				{
					cout << "Delete this data 0. Yes 1. No";
					cin >> x_0;
					if (x_0 == '0')
					{
						q->next = p->next;
						deletep; p = q; }}if (x == 3)// Modify the data
				{
					cout << "Whether to modify this data 0. Yes 1. No";
					cin >> x_0;
					if (x_0 == '0')
					{
						Modify_small(p);
					}
				}
			}

			q = p;
			p = p->next;
		}cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
		if (i == 0)
			cout << "Can you be serious? There's no data." << endl;
	}
	void Find_02number(int x = 1)// Find the student id
	{
		int i = 0;
		long num;
		string tmp;
		char x_0 = '1';
		student_Node *p = head->next, *q = head;
		cout << Please enter the student number you are looking for:;
		cin >> tmp;
		num = atol(tmp.c_str());
		cout << left << setw(5) < <", serial number," << left << setw(8) < <"· Name · << left << setw(15) < <· Student Number · << left << setw(8) < <", gender," << left << setw(10) < <"College", << left << setw(10) < <", class," << left << setw(8) < <"| | total score" << left << setw(8) < <"Scored an average | |" << endl << endl;
		while(p ! =NULL)
		{
			if (p->Number == num)
			{
				cout << left << setw(3) < <"" << left << setw(3) << i++ << "" << *p;
				if (x == 2)// Delete data
				{
					cout << "Delete this data 0. Yes 1. No";
					cin >> x_0;
					if (x_0 == '0')
					{
						q->next = p->next;
						deletep; p = q; }}if (x == 3)// Modify the data
				{
					cout << "Whether to modify this data 0. Yes 1. No";
					cin >> x_0;
					if (x_0 == '0')
					{
						Modify_small(p);
					}
				}
			}
			q = p;
			p = p->next;
		}
		cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
		if (i == 0)
			cout << "Can you be serious? There's no data." << endl;
	}
	void Find_03academy(int x = 1)// College search
	{
		int i = 0;
		string tmp;
		char x_0 = '1';
		student_Node *p = head->next, *q = head;
		cout << "Please enter the college you are looking for:";
		cin >> tmp;
		cout << left << setw(5) < <", serial number," << left << setw(8) < <"· Name · << left << setw(15) < <· Student Number · << left << setw(8) < <", gender," << left << setw(10) < <"College", << left << setw(10) < <", class," << left << setw(8) < <"| | total score" << left << setw(8) < <"Scored an average | |" << endl << endl;
		while(p ! =NULL)
		{
			if (p->Academy == tmp)
			{
				cout << left << setw(3) < <"" << left << setw(3) << ++i << "" << *p;
				if (x == 2)
				{
					cout << "Delete this data 0. Yes 1. No";
					cin >> x_0;
					if (x_0 == '0')
					{
						q->next = p->next;
						deletep; p = q; }}if (x == 3)// Modify the data
				{
					cout << "Whether to modify this data 0. Yes 1. No";
					cin >> x_0;
					if (x_0 == '0')
					{
						Modify_small(p);
					}
				}
			}
			q = p;
			p = p->next;
		}
		cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
		if (i == 0)
			cout << "Can you be serious? There's no data." << endl;
	}
	void Modify(a)		// Modify the interface to add some lines to add aesthetics
	{
		Find(3);
		Filewrite(a);// Write to the file
	}
	void Modify_small(student_Node *p)
	{
		char a = '0';
		string tmp;
		long num;
		while (a == '0')
		{
			cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
			cout << "Please select modify option 1. Name 2. Student NUMBER 3. Class 6. Grade";
			cin >> a;
			cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
			switch (a)
			{
			case '1':
				cout << "Enter a name:";
				cin >> tmp;
				p->SetName(tmp);
				break;
			case '2':
				cout << "Enter student number:";
				cin >> tmp;
				num = atol(tmp.c_str());
				p->SetNumber(num);
				break;
			case '3':
				cout << "Enter gender:";
				cin >> tmp;
				p->SetSex(tmp);
				break;
			case '4':
				cout << "Input college:";
				cin >> tmp;
				p->SetAcademy(tmp);
				break;
			case '5':
				cout << "Please enter class:";
				cin >> tmp;
				p->SetClass(tmp);
				break;
			case '6':
				p->SetLesson(a);// Modify the course
				break;
			default:
				cout << "You're cute. You screwed up, honey." << endl;
			}
			cout << *p;
			cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;// Beautify the visual effects
			cout << "Continue to modify other options 0. Continue 1. No"; cin >> a; }}void Sort(a)			/ / sorting
	{
		Fileread(a);char t = '0';
		while (t == '0')
		{
			cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
			cout << "1. Student number 2. Single subject grade 3.;
			cin >> t;
			switch (t)
			{
			case '1':
				Sort_small(1); break;// Student number sort
			case '2':
				Sort_small(2); break;// Single subject ranking
			case '3':
				Sort_small(3); break;// The overall ranking
			default:
				Filewrite(a);//
				return;
			}
			Display(0);
			cout << "Do you want to continue sorting? 0. Continue 1.;
			cin >> t;
		}
		Filewrite(a);// Write to the file
	}
	void Sort_small(int i = 1)1. Default student id 2. 3. Overall score
	{
		char t; int x;
		if (i == 2)// Single subject scores are sorted
		{
			L.Dislesson(a);// Display public courses
			cin >> t;
			x = t - '0';// The subscript of the course
			if (x>L.n || x<0)
			{
				cout << "Wrong choice" << endl;
				return;
			}
		}
		cout << "1. Increasing 2. Decreasing";
		student_Node *p1, *p2;
		student_Node tmp;
		int flag = 1;
		cin >> t;
		while (1)// Bubble sort
		{
			flag = 1;
			p1 = head->next; p2 = p1->next;
			while(p2 ! =NULL)
			{
				switch (t)
				{
				case '1':
					if (i == 3)// Total sort
						if (p1->Less.Mount_s>p2->Less.Mount_s)
						{
							tmp = *p1;
							*p1 = *p2;
							*p2 = tmp;
							flag = 0;
						}
					if (i == 2)// The result is sorted
						if (p1->Less.lesson[x - 1].grade>p2->Less.lesson[x - 1].grade)
						{
							tmp = *p1;
							*p1 = *p2;
							*p2 = tmp;
							flag = 0;
						}
					if (i == 1)// Student number sort
						if (p1->Number>p2->Number)
						{
							tmp = *p1;
							*p1 = *p2;
							*p2 = tmp;
							flag = 0;
						}; break;
				case '2':
					if (i == 3)// Total sort
						if (p1->Less.Mount_s<p2->Less.Mount_s)
						{
							tmp = *p1;
							*p1 = *p2;
							*p2 = tmp;
							flag = 0;
						}
					if (i == 2)// The result is sorted
						if (p1->Less.lesson[x - 1].grade<p2->Less.lesson[x - 1].grade)
						{
							tmp = *p1;
							*p1 = *p2;
							*p2 = tmp;
							flag = 0;
						}
					if (i == 1)// Student number sort
						if (p1->Number<p2->Number)
						{
							tmp = *p1;
							*p1 = *p2;
							*p2 = tmp;
							flag = 0;
						}; break;
				default:
					break;
				}

				p1 = p1->next;
				p2 = p2->next;
			}
			if (flag == 1)
				break; }}void Cal(a)			// It needs to be powerful to calculate the total grade and average grade of each subject
	{
		Fileread(a); cout <<"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
		cout << left << setw(10) < <"Subject" << left << setw(10) < <"Total" << left << setw(10) < <"Average score" << left << setw(10) < <"Pass rate" << endl;// Three Spaces
		for (int i = 0; i<L.n; i++)
			Cal_small(L.lesson[i].L_name);
		cin.get(a); cin.get(a); }void Cal_small(string na)
	{
		student_Node *p = head->next;
		int num_1 = 0, num_n = 0, num_p = 0;
		while(p ! =NULL)
		{
			for (int i = 0; i<p->Less.n; ++i)
			{
				if (p->Less.lesson[i].L_name == na)
				{
					num_n++;/ / the total number
					num_1 = num_1 + p->Less.lesson[i].grade;
					if (p->Less.lesson[i].grade >= 60)
						num_p++;// Number of people passed
					break;
				}
			}
			p = p->next;
		}
		cout << left << setw(10) << na << left << setw(10) << num_1 << left << setw(10) << num_1 / num_n << left << setw(3) < < (float)num_p / (float)num_n * 100 << "%" << endl;
	}
	float Grade_fail(string name, int grade)		// Calculate the percentage of students who beat the whole school
	{
		int num_1 = 0, num_2 = 0;
		float num;
		student_Node *p = head->next;
		while(p ! =NULL)
		{
			for (int i = 0; i<p->Less.n; i++)
			{
				if (name == p->Less.lesson[i].L_name)// Count the number of people taking the course
				{
					num_1++;
					if (p->Less.lesson[i].grade <= grade)
						num_2++;// The number of people who scored worse than you
					break;
				}
			}
			p = p->next;
		}
		num = (float)num_2 / (float)num_1 * 100;// Type conversion
		return num;
	}
	void student_pass(string na, string num)		// Student login information
	{
		Fileread(a); student_Node *p = head->next;while(p ! =NULL)
		{
			if (p->Name == na&&p->Number == atol(num.c_str()))
				break;
			p = p->next;
		}
		if (p == NULL)
		{
			cout << "There is no such student !!!!";
			cin.get(a); cin.get(a);return;
		}
		int i = 0;
		system("cls");
		cout << endl << endl << "I am" << p->Name << "My number is." << p->Number << "Gender" << p->Sex << "At present" << p->Academy << p->Class << "Ben, deep work and name ~" << endl << endl;
		cout << left << setw(15) < <"Subject" << "Performance" << endl;
		cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
		for (i = 0; i<p->Less.n; i++)
		{
			cout << left << setw(15) << p->Less.lesson[i].L_name << "" << p->Less.lesson[i].grade << "I beat the whole school." << Grade_fail(p->Less.lesson[i].L_name, p->Less.lesson[i].grade) << "%" << endl;
			cout << "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --" << endl;
		}
		cin.get(a); cin.get();
	}
};
const string Pass_word = "123456";// Teacher login password
void Meue_studentpass(a)// Student login
{
	student_List B;
	string na, num;
	cout << "\n\n Please enter student number:";
	cin >> num;
	cout << "Please enter your name:";
	cin >> na;
	B.student_pass(na, num);
}
void Meue(a)				// Main menu interface
{
	while (1)
	{
		system("cls");
		cout << "\n\n\n\n\n";
		cout << "★★★ teacher I super love you, for you jump big god ★★★" << endl;
		cout << "▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁." " << endl;
		cout << "▏ ▕." " << endl;
		cout << "Affect1. Input ▕" << endl;
		cout << "Affect2. Output ▕" << endl;
		cout << "Affect3. Public curriculum setting ▕" << endl;
		cout << "Affect4. Add ▕" << endl;// become arbitrary insert position
		cout << "Affect5. Search ▕" << endl;
		cout << "Affect. delete ▕" << endl;
		cout << "Affect. modify ▕" << endl;
		cout << "Affect. sort ▕" << endl;
		cout << "Affect. calculation ▕" << endl;
		cout << "Affd exit login ▕" << endl;
		cout << "▏ ▕." " << endl;
		cout << "▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔ ▔" << endl;
		student_List A;// Create a linked list and initialize it
		char t;
		cin >> t;
		system("cls");
		switch (t)
		{
		case '1':
			A.Putin(a);break;
		case '2':
			A.Display(a);break;
		case '3':
			L.SetPbulicLesson(a);break;
		case '4':
			A.Insert(a);break;
		case '5':
			A.Find(a);break;
		case '6':
			A.Delete(a);break;
		case '7':
			A.Modify(a);break;
		case '8':
			A.Sort(a);break;
		case '9':
			A.Cal(a);break;
		case '0':return;
		default:
			break; }}}void Welcome(a)			// Start the login screen
{
	system("cls");

	cout << "\n\n\n\n\n\n";
	cout << "☆ Student Achievement Management System << endl;
	cout << " anthor:Codebowl" << endl;
	cout << "▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇" << endl;
	cout << Painted "u" << endl;
	cout << "★ 1. Teacher Login ★" << endl;
	cout << "★ 2. Student Login ★" << endl;
	cout << "★ 0. Exit ★" << endl;
	cout << Painted "u" << endl;
	cout << "▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇";
	char x;
	string tmp;
	cin >> x;
	switch (x)
	{
	case '0':exit(0);
	case '1':
		cout << "\n\n Please enter your password:";
		cin >> tmp;
		if (tmp == Pass_word)					// Check whether the password is passed
			Meue(a);break;
	case '2':
		Meue_studentpass(a);break;
	}
	//_sleep(2*1000); // Delay command
}
int main(a)
{
	while (1)
		Welcome(a);return 0;
}
Copy the code

achievement

Students’ favorability +10 Teachers’ favorability +5 (Innovation score)

After that, CodeBowl will also share a lot of computer-related lessons and C++ content. My primary school sister has so many questions.

Finally, think about when you’re going to have a dinner that you’ve promised for two years.