c++学生信息统计

最近学校的学生统计系统坏了,于是乎,我在经历了无数个bug后,写出了12.10版本的学生信息统计,代码如下:(老师估计挺喜欢)

#include<iostream>
#include<cstring>
#include<cstdio>
#include<windows.h>
using namespace std;
void color(short x)  {
	if(x>=0&&x<=15)
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x);
}
struct colorParameters {//颜色调整结构体
	short frame=8;//边框颜色色号
	short title=9;//标题颜色色号
	short option=3;//正文颜色色号
	short tacit=15;//默认颜色色号
	short message=4;//信息预览颜色色号
	short warning=4;//警告颜色色号
};
colorParameters ers;
class Operation {
	private:
		int number;
	public:
		void charge(int people);
		void inputPeople();
		void inputAchievement();
		void output();
		int total();
		void sorting();
		void SortingNoOutput();
		void lookup(int max,int low);
		void replace1(int n);
		void replace2(int n);
		void clean();
		void maximal();
		void average();
};
struct student {
	int num;
	string name;
};
student stu[10000];
struct achievement {
	float score;
};
achievement ach[10000];
struct seqencing {
	int num;
	string name;
	float score;
};
seqencing seq[10000];
struct numb {
	int num;
	string name;
	float score;
};
numb num;
struct maxValue {
	int num;
	string name;
	float score;
};
maxValue lue;
struct mean {
	int num;
};
mean ean;
void Operation::charge(int people) {
	number=people;
}
void Operation::inputPeople() {
	for(int i=0; i<number; i++) {
		cin>>stu[i].num>>stu[i].name;
	}
	cout<<"输入完毕,正在跳转至主页面";
	Sleep(0.5*1000);
}
void Operation::inputAchievement() {
	for(int i=0; i<number; i++) {
		cout<<stu[i].num<<" "<<stu[i].name<<" ";
		cin>>ach[i].score;
	}
	cout<<"输入完毕,正在跳转至主页面";
	Sleep(0.5*1000);
}
void Operation::output() {
	for(int i=0; i<number; i++) {
		cout<<stu[i].num<<" "<<stu[i].name<<" "<<ach[i].score<<endl;
	}
}
int Operation::total() {
	int to=0;
	for(int i=0; i<number; i++) {
		to+=ach[i].score;
	}
	return to;
}
void Operation::sorting() {
	for(int i=0; i<number; i++) {
		seq[i].num=stu[i].num;
		seq[i].name=stu[i].name;
		seq[i].score=ach[i].score;
	}
	for(int i=0; i<number; i++) {
		for(int j=0; j<number; j++) {
			if(seq[j].score<seq[j+1].score) {
				num.num=seq[j].num;
				seq[j].num=seq[j+1].num;
				seq[j+1].num=num.num;
				num.name=seq[j].name;
				seq[j].name=seq[j+1].name;
				seq[j+1].name=num.name;
				num.score=seq[j].score;
				seq[j].score=seq[j+1].score;
				seq[j+1].score=num.score;
			}
		}
	}
	for(int i=0; i<number; i++) {
		cout<<seq[i].num<<" "<<seq[i].name<<" "<<seq[i].score<<endl;
	}
}
void Operation::SortingNoOutput() {
	for(int i=0; i<number; i++) {
		seq[i].num=stu[i].num;
		seq[i].name=stu[i].name;
		seq[i].score=ach[i].score;
	}
	for(int i=0; i<number; i++) {
		for(int j=0; j<number; j++) {
			if(seq[j].score<seq[j+1].score) {
				num.num=seq[j].num;
				seq[j].num=seq[j+1].num;
				seq[j+1].num=num.num;
				num.name=seq[j].name;
				seq[j].name=seq[j+1].name;
				seq[j+1].name=num.name;
				num.score=seq[j].score;
				seq[j].score=seq[j+1].score;
				seq[j+1].score=num.score;
			}
		}
	}
}
void Operation::lookup(int max,int low) {
	for(int i=low-1; i<max-1; i++) {
		cout<<i<<" "<<seq[i].num<<" "<<seq[i].name<<" "<<seq[i].score<<endl;
	}
}
void Operation::replace1(int n) {
	cout<<"替换前:"<<stu[n-1].num<<" "<<stu[n-1].name<<endl;
	cout<<"替换为:";
	cin>>stu[n-1].num>>stu[n-1].name;
	cout<<"替换完毕,正在跳转至主页面";
}
void Operation::replace2(int n) {
	cout<<"替换前:"<<stu[n-1].name<<" "<<ach[n-1].score<<endl;
	cout<<"替换为(替换";
	color(ers.message);
	cout<<"分数";
	color(ers.tacit);
	cout<<"):";
	cin>>ach[n-1].score;
	cout<<"替换完毕,正在跳转这主页面";
}
void Operation::clean() {
	for(int i=0; i<number; i++) {
		stu[i].num=0;
		stu[i].name='\0';
		ach[i].score=0;
	}
	number=0;
}
void Operation::maximal() {
	lue.num=seq[0].num;
	lue.name=seq[0].name;
	lue.score=seq[0].score;
}
void Operation::average() {
	int totalValue=0;
	for(int i=0; i<number; i++) {
		totalValue+=ach[i].score;
	}
	ean.num=totalValue/number;
}
void help() {
	int ndef=0;
	system("cls");
	system("color 4F");
	cout<<"<返回  输入1        "<<endl;
	cout<<"===================="<<endl;
	cout<<"=      警告!      ="<<endl;
	cout<<"===================="<<endl;
	cout<<"= 您键入了无效信息 ="<<endl;
	cout<<"= 请您按照提示输入 ="<<endl;
	cout<<"= 不要输入字符类型 ="<<endl;
	cout<<"= 不要在加载时输入 ="<<endl;
	cout<<"===================="<<endl;
	cout<<"=错误的输入可能导致="<<endl;
	cout<<"=     系统崩溃     ="<<endl;
	cout<<"===================="<<endl;
	cout<<"=主程序附加保护程序="<<endl;
	cout<<"===================="<<endl;
	cin>>ndef;
	if(ndef!=1)
		help();
}
void collapse() {
	bool c=true;
	system("color 4F");
	system("cls");
	cout<<"===================="<<endl;
	cout<<"=   崩溃重启程序   ="<<endl;
	cout<<"===================="<<endl;
	cout<<"=程序崩溃,正在重启="<<endl;
	cout<<"===================="<<endl;
	cout<<"=  重启时请勿键入  ="<<endl;
	cout<<"=      请等待      ="<<endl;
	cout<<"=重启后可能丢失部分="<<endl;
	cout<<"=       信息       ="<<endl;
	cout<<"===================="<<endl;
	cout<<"=主程序附加保护程序="<<endl;
	cout<<"===================="<<endl;
	cout<<endl;
	cout<<"Loading..."<<endl;
	Sleep(3*1000);
	system("cls");
	cout<<"===================="<<endl;
	cout<<"=   崩溃重启程序   ="<<endl;
	cout<<"===================="<<endl;
	cout<<"= 即将跳转至主程序 ="<<endl;
	cout<<"=或再次尝试重启程序="<<endl;
	cout<<"=此前勿进行任何操作="<<endl;
	cout<<"===================="<<endl;
	cout<<"=主程序附加保护程序="<<endl;
	cout<<"===================="<<endl;
	Sleep(1.2*1000);
	cout<<endl;
	cout<<"报错信息:"<<endl;
	for(int i=0; i<15; i++) {
		cout<<"Warning:Error!"<<endl;
		Sleep(0.0176*1000);
	}
	Sleep(0.2*1000);
	cout<<"Loading...>>正在处理"<<endl;
	Sleep(0.5*1000);
	system("cls");
}
void skip(int n) {
	system("cls");
	color(ers.frame);
	cout<<"===================="<<endl;
	cout<<"=";
	color(ers.title);
	cout<<"       警告       ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"===================="<<endl;
	cout<<"=";
	color(ers.warning);
	cout<<"       错误       ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"=";
	color(ers.option);
	cout<<"  即将 进行 处理  ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"=";
	color(ers.option);
	cout<<" 或跳转至保护程序 ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"===================="<<endl;
	cout<<endl;
	Sleep(2*1000);
	color(ers.tacit);
	if(n==0) {
		collapse();
	} else {
		help();
	}
}
void intercept() {
	system("cls");
	color(ers.frame);
	cout<<"===================="<<endl;
	cout<<"=";
	color(ers.title);
	cout<<"       错误       ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"===================="<<endl;
	cout<<"=";
	color(ers.warning);
	cout<<"    无可用信息    ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"=";
	color(ers.option);
	cout<<"    详见快捷栏    ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"===================="<<endl;
	cout<<"=";
	color(ers.option);
	cout<<"  *2秒后自动返回  ";
	color(ers.frame);
	cout<<"="<<endl;
	cout<<"===================="<<endl;
	color(ers.tacit);
	Sleep(2*1000);
}
int main() {
	while(1) {
		cout<<"启动中"<<endl;
		cout<<"请等待"<<endl;
		cout<<"Loading..."<<endl;
		bool encryption=false;
		bool information=false;
		bool achievement=false;
		Operation myOperation;
		bool run=true;
		int n=0;
		Sleep(0.2*1000);
		int n1=0;
		while(run) {
			system("cls");
			system("color 0F");
			if(information==false&&achievement==false) {
				color(ers.frame);
				cout<<"====================        ===================="<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.title);
				cout<<"学生信息统计主页面";
				color(ers.frame);
				cout<<"=        =";
				color(ers.title);
				cout<<"快捷栏暂无可用信息";
				color(ers.frame);
				cout<<"="<<endl;
				color(ers.frame);
				cout<<"====================        ===================="<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"1:录入学生个人信息";
				color(ers.frame);
				cout<<"=";
				color(ers.message);
				cout<<"        请输入学生信息及成绩";
				color(ers.tacit);
				cout<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"2:录入学生考试成绩";
				color(ers.frame);
				cout<<"=";
				color(ers.warning);
				cout<<"        输入前请不要进行操作";
				color(ers.tacit);
				cout<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"3:显示学生信息成绩";
				color(ers.frame);
				cout<<"=";
				color(ers.warning);
				cout<<"        否则可能导致程序崩溃";
				color(ers.tacit);
				cout<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"4:统计 / 排序 成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"5:学号查找学生成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"6:排名查找符合学生";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"7:更改学生个人信息";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"8:更改学生考试成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"9:清除所有可用信息";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"0:更改程序界面颜色";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"===================="<<endl;
				cout<<"=";
				color(5);
				cout<<"第12次对主程序更新";
				color(ers.frame);
				cout<<"="<<endl;
				cout<<"===================="<<endl;
			} else if(information==true&&achievement==false) {
				color(ers.frame);
				cout<<"====================        ===================="<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.title);
				cout<<"学生信息统计主页面";
				color(ers.frame);
				cout<<"=        =";
				color(ers.title);
				cout<<"已录入学生个人信息";
				color(ers.frame);
				cout<<"="<<endl;
				color(ers.frame);
				cout<<"====================        ===================="<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"1:录入学生个人信息";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        学生基本信息:";
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"2:录入学生考试成绩";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        人数:";
				color(ers.message);
				cout<<n1;
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"3:显示学生信息成绩";
				color(ers.frame);
				cout<<"=";
				color(ers.message);
				cout<<"        请输入考试成绩";
				color(ers.tacit);
				cout<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"4:统计 / 排序 成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"5:学号查找学生成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"6:排名查找符合学生";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"7:更改学生个人信息";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"8:更改学生考试成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"9:清除所有可用信息";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"0:更改程序界面颜色";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"===================="<<endl;
				cout<<"=";
				color(5);
				cout<<"第12次对主程序更新";
				color(ers.frame);
				cout<<"="<<endl;
				cout<<"===================="<<endl;
			} else if(information==true&&achievement==true) {
				myOperation.SortingNoOutput();
				myOperation.maximal();
				myOperation.average();
				color(ers.frame);
				cout<<"====================        ===================="<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.title);
				cout<<"学生信息统计主页面";
				color(ers.frame);
				cout<<"=        =";
				color(ers.title);
				cout<<"已录入学生个人信息";
				color(ers.frame);
				cout<<"="<<endl;
				color(ers.frame);
				cout<<"====================        ===================="<<endl;
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"1:录入学生个人信息";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        学生基本信息:";
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"2:录入学生考试成绩";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        人数:";
				color(ers.message);
				cout<<n1;
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"3:显示学生信息成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"4:统计 / 排序 成绩";
				color(ers.frame);
				cout<<"=";
				cout<<"        ====================";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"5:学号查找学生成绩";
				color(ers.frame);
				cout<<"=";
				cout<<"        =";
				color(ers.title);
				cout<<"已录入学生考试成绩";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"6:排名查找符合学生";
				color(ers.frame);
				cout<<"=";
				cout<<"        ====================";
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"7:更改学生个人信息";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        成绩基本信息:";
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"8:更改学生考试成绩";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        最高分:";
				color(ers.message);
				cout<<lue.num<<" "<<lue.name<<" "<<lue.score;
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"9:清除所有可用信息";
				color(ers.frame);
				cout<<"=";
				color(ers.option);
				cout<<"        平均分:";
				color(ers.message);
				cout<<ean.num;
				color(ers.frame);
				cout<<endl;
				cout<<"=";
				color(ers.option);
				cout<<"0:更改程序界面颜色";
				color(ers.frame);
				cout<<"=";
				cout<<endl;
				cout<<"===================="<<endl;
				cout<<"=";
				color(5);
				cout<<"第12次对主程序更新";
				color(ers.frame);
				cout<<"="<<endl;
				cout<<"===================="<<endl;
			} else {
				myOperation.clean();
				skip(0);
				break;
			}
			color(ers.tacit);
			cout<<endl;
			color(ers.message);
			cout<<"   [";
			color(9);
			cout<<"请选择功能:";
			color(ers.message);
			cout<<"]";
			color(ers.option);
			cout<<endl;
			cin>>n;
			cout<<"Loading..."<<endl;
			if(n<100) {
				switch(n) {
					case 1: {
						n1=0;
						system("cls");
						color(ers.frame);
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.title);
						cout<<" 录入学生信息界面 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<" 输入人数(";
						color(ers.message);
						cout<<"<10000";
						color(ers.option);
						cout<<") ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						color(ers.tacit);
						cout<<endl;
						cout<<"请按上方提示输入:";
						cin>>n1;
						cout<<"Loading...";
						if(n1<=100) {
							myOperation.charge(n1);
						} else {
							help();
							break;
						}
						system("cls");
						color(ers.frame);
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.title);
						cout<<" 录入学生信息界面 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"= ";
						color(ers.option);
						cout<<"输入具体学生信息";
						color(ers.frame);
						cout<<" ="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"  格式:学号 姓名  ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						color(ers.tacit);
						cout<<endl;
						cout<<"请按上方提示输入:"<<endl;
						myOperation.inputPeople();
						information=true;
						cout<<"Loading...";
						break;
					}
					case 2: {
						system("cls");
						color(ers.frame);
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.title);
						cout<<" 录入考试成绩界面 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"按学号输入考试成绩";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<" 以回车键分隔成绩 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						color(ers.tacit);
						cout<<endl;
						cout<<"请按上方提示输入:"<<endl;
						myOperation.inputAchievement();
						achievement=true;
						cout<<"Loading...";
						break;
					}
					case 3: {
						if(information==true&&achievement==true) {
							int n3=0;
							system("cls");
							color(ers.tacit);
							cout<<"<返回  输入1"<<endl;
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 显示信息成绩界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"     信息如下     ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							myOperation.output();
							cout<<endl;
							cin>>n3;
							cout<<"Loading...";
							if(n3==1)
								break;
							else {
								help();
								break;
							}
						} else
							intercept();
						break;
					}
					case 4: {
						if(information==true&&achievement==true) {
							int n4=0;
							system("cls");
							cout<<"<返回  输入3"<<endl;
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<"统计/排序 成绩界面";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"    1:统计总分    ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"    2:成绩排序    ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cin>>n4;
							cout<<"Loading...";
							if(n4==1) {
								int n41=0;
								system("cls");
								color(ers.tacit);
								cout<<"<返回  输入1"<<endl;
								color(ers.frame);
								cout<<"===================="<<endl;
								cout<<"=";
								color(ers.title);
								cout<<"   统计总分界面   ";
								color(ers.frame);
								cout<<"="<<endl;
								cout<<"===================="<<endl;
								color(ers.tacit);
								cout<<endl;
								cout<<"本次测试的总分是:"<<myOperation.total();
								cout<<endl;
								color(ers.message);
								cout<<"您可以在快捷栏内进行预览"<<endl;
								color(ers.tacit);
								cout<<endl;
								cin>>n41;
								cout<<"Loading...";
								if(n41==1)
									break;
								else {
									help();
									break;
								}
							} else if(n4==2) {
								int n42=0;
								system("cls");
								cout<<"<返回  输入1"<<endl;
								color(ers.frame);
								cout<<"===================="<<endl;
								cout<<"=";
								color(ers.title);
								cout<<"   成绩排序界面   ";
								color(ers.frame);
								cout<<"="<<endl;
								cout<<"===================="<<endl;
								cout<<"=";
								color(ers.option);
								cout<<"     排序如下     ";
								color(ers.frame);
								cout<<"="<<endl;
								cout<<"===================="<<endl;
								color(ers.tacit);
								cout<<endl;
								myOperation.sorting();
								cout<<endl;
								cin>>n42;
								cout<<"Loading...";
								if(n42==1)
									break;
								else {
									help();
									break;
								}
							} else if(n4==3) {
								break;
							} else {
								help();
								break;
							}
						} else {
							intercept();
							break;
						}
					}
					case 5: {
						if(information==true&&achievement==true) {
							int n5=0;
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 学号查找成绩界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"输入查找学生的学号";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cout<<"请按上方提示输入:";
							cin>>n5;
							cout<<"Loading..."<<endl;
							int Return=0;
							system("cls");
							cout<<"<返回  输入1"<<endl;
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"= ";
							color(ers.title);
							cout<<"学号查找学生成绩 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cout<<"该学生信息:"<<endl;
							cout<<"学号:"<<stu[n5-1].num<<endl;
							cout<<"姓名:"<<stu[n5-1].name<<endl;
							cout<<"成绩:"<<ach[n5-1].score<<endl;
							cout<<endl;
							cin>>Return;
							cout<<"Loading...";
							if(Return==1)
								break;
							else {
								help();
								break;
							}
						} else {
							intercept();
							break;
						}
					}
					case 6: {
						if(information==true&&achievement==true) {
							int max=0;
							int low=0;
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 排名查找学生界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<" 输入查找排名区间 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"格式:最";
							color(ers.message);
							cout<<"大";
							color(ers.option);
							cout<<"值 最";
							color(ers.message);
							cout<<"小";
							color(ers.option);
							cout<<"值";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cout<<"请按上方提示输入:";
							cin>>max>>low;
							cout<<"Loading...";
							if(max<=low) {
								help();
								break;
							}
							int n6;
							myOperation.sorting();
							system("cls");
							color(ers.tacit);
							cout<<"<返回  输入1"<<endl;
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 排名查找学生界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cout<<low;
							color(ers.option);
							cout<<"~";
							color(ers.tacit);
							cout<<max;
							color(ers.option);
							cout<<"名学生信息:"<<endl;
							color(ers.tacit);
							for(int i=low-1; i<max; i++) {
								cout<<i+1<<" "<<seq[i].num<<" "<<seq[i].name<<" "<<seq[i].score<<endl;
							}
							cout<<endl;
							cin>>n6;
							if(n6==1) {
								cout<<"loading...";
								break;
							} else {
								help();
								break;
							}
						} else {
							intercept();
							break;
						}
					}
					case 7: {
						if(information==true) {
							int n7=0;
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 更改学生信息界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<" 输入更改学生学号 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cout<<"请按上方提示输入:";
							cin>>n7;
							cout<<"Loading...";
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 更改学生信息界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							myOperation.replace1(n7);
							cout<<"Loading...";
							break;
						} else {
							intercept();
							break;
						}

					}
					case 8: {
						if(information==true&&achievement==true) {
							int n8=0;
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 更改考试成绩界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<" 输入更改学生学号 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cout<<"请按上方提示输入:";
							cin>>n8;
							cout<<"Loading...";
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 更改考试成绩界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							myOperation.replace2(n8);
							cout<<"Loading...";
							break;
						} else {
							intercept();
							break;
						}

					}
					case 9: {
						if(information==true&&achievement==true) {
							int n10=0;
							system("cls");
							color(ers.frame);
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.title);
							cout<<" 清除学生信息界面 ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"清除的数据无法恢复";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"=";
							color(ers.option);
							cout<<"    是否清除?    ";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"=";
							color(ers.warning);
							cout<<"1:清除      ";
							color(ers.option);
							cout<<"2:取消";
							color(ers.frame);
							cout<<"="<<endl;
							cout<<"===================="<<endl;
							color(ers.tacit);
							cout<<endl;
							cin>>n10;
							cout<<"Loading...";
							if(n10==1) {
								myOperation.clean();
								information=false;
								achievement=false;
								break;
							} else if(n10==2) {
								break;
							} else {
								help();
								break;
							}
						} else {
							intercept();
							break;
						}

					}
					case 0: {
						int n01;
						system("cls");
						color(ers.frame);
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.title);
						cout<<" 更改程序颜色界面 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"输入更改颜色的区域";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"1:边框      2:标题";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"3:正文      4:默认";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"5:预览      6:警告";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						color(ers.tacit);
						cout<<endl;
						cin>>n01;
						system("cls");
						int n02;
						color(ers.frame);
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.title);
						cout<<" 更改程序颜色界面 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"=";
						color(ers.option);
						cout<<"     色号:1~15    ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						cout<<"=";
						color(1);
						cout<<"1 ";
						color(2);
						cout<<"2 ";
						color(3);
						cout<<"3 ";
						color(4);
						cout<<"4 ";
						color(5);
						cout<<"5 ";
						color(6);
						cout<<"6 ";
						color(7);
						cout<<"7 ";
						color(8);
						cout<<"8 ";
						color(9);
						cout<<"9 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"=";
						color(10);
						cout<<"10 ";
						color(11);
						cout<<"11 ";
						color(12);
						cout<<"12 ";
						color(13);
						cout<<"13 ";
						color(14);
						cout<<"14 ";
						color(15);
						cout<<"15 ";
						color(ers.frame);
						cout<<"="<<endl;
						cout<<"===================="<<endl;
						color(ers.tacit);
						cout<<endl;
						cin>>n02;
						if(n01==1)
							ers.frame=n02;
						else if(n01==2)
							ers.title=n02;
						else if(n01==3)
							ers.option=n02;
						else if(n01==4)
							ers.tacit=n02;
						else if(n01==5)
							ers.message=n02;
						else if(n01==6)
							ers.warning=n02;
						else
							help();
						cout<<"更改完毕";
						Sleep(0.5*1000);
						break;
					}
					default: {
						help();
						break;
					}
				}
			}
			else {
				system("cls");
				cout<<"错误!";
				return 0;
			}
		}
		collapse();
	}
	return 0;
}

代码制作不易,有不足之处还请见谅,别忘了加关注哦!

下期更精彩~

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
代码: #include #include #include #include #define Smax 200 using namespace std; struct student { string num; string name; float eng; float math; float clang;//定义c++ float gete(){return eng;} float getm(){return math;} float getcl(){return clang;} string getn(){return num;} string getna(){return name;} int rank[3]; int row;//排名 int sinto(string,string,float,float,float);//输入数据 void sshow();//输出数据 float sall();// 求和 float save();//求平均 void objrank();//成绩分类 }; void shows()//普通函数 { cout<<setw(6)<<"排名"<<setw(6)<<"学号"<<setw(10)<<"姓名" <<setw(6)<<"英语"<<setw(6)<<"数学"<<setw(6)<<"c++" <<setw(6)<<"总分"<<setw(10)<<"平均分"<<endl; } int student::sinto(string a1,string a2,float b1,float b2,float b3 ) { num=a1;name=a2; eng=b1;math=b2;clang=b3; return 0; } void student::sshow()//输出 { cout<<setw(6)<<row<<setw(6)<<num<<setw(10)<<name<<setw(6) <<eng<<setw(6)<<math<<setw(6)<<clang<<setw(6)<<sall() <<setw(10)<<setiosflags(ios::fixed)<<setprecision(1)<<save()<<endl; cout<<setiosflags(ios::fixed)<<setprecision(0); } float student::sall()//求总分 { return eng+math+clang; } float student::save()//求平均分 {return sall()/3;} void student::objrank() { int n; rank[0]=(int)eng; rank[1]=(int)math; rank[2]=(int)clang; for(int i=0;i<3;i++) { n=rank[i]/10; switch(n) { case 9:n=1;break; case 8:n=2;break; case 7:n=3;break; case 6:n=4;break; default:n=5;} rank[i]=n; } } //类student结束 //类leo开始 class leo {private: student item[Smax]; int size; public: leo(); void lsize(int);//设置数组大小 void linit();//清空 void linsert();//添加 void ldelet(string);//删除 void lsearch(string);//查找 void lchan(string);//修改 void lpcent();//成绩分类 void lrow();//排序 void obave();//求平均 void lview();//显示全部数据 void lcin();//从磁盘输出 void lcout();//储存到磁盘 }; leo::leo() { student item[Smax]; lsize(0); } void leo::lsize(int i) {size=i; } void leo::linit() { lsize(0); cout<<"学生数据清除成功"<<endl;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值