c++学生信息统计
时间:2022-11-10 14:00:00
最近学校的学生统计系统坏了,所以我经历了无数次bug后,写出了12.10版学生信息统计,代码如下:(估计老师很喜欢)
#include #include #include #include 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>stu[i].num>>stu[i].name; } cout<<"输入完毕,跳转到主页"; Sleep(0.5*1000); } void Operation::inputAchievement() { for(int i=0; i>ach[i].score; } cout<<"输入完毕,跳转到主页"; Sleep(0.5*1000); } void Operation::output() { for(int i=0; i>stu[n-1].num>>stu[n-1].name; cout<<"替换完毕,跳转到主页"; } void Operation::replace2(int n) { cout<<"替换前:"<>ach[n-1].score; cout<<"替换完毕,主页跳转"; } void Operation::clean() { for(int i=0; i>ndef;
if(ndef!=1)
help();
}
void collapse() {
bool c=true;
system("color 4F");
system("cls");
cout<<"===================="<>正在处理"<基本信息:";
color(ers.frame);
cout<>n;
cout<<"Loading..."<>n1;
cout<<"Loading...";
if(n1<=100) {
myOperation.charge(n1);
} else {
help();
break;
}
system("cls");
color(ers.frame);
cout<<"===================="<>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"<>n4;
cout<<"Loading...";
if(n4==1) {
int n41=0;
system("cls");
color(ers.tacit);
cout<<"<返回 输入1"<>n41;
cout<<"Loading...";
if(n41==1)
break;
else {
help();
break;
}
} else if(n4==2) {
int n42=0;
system("cls");
cout<<"<返回 输入1"<>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<<"===================="<>n5;
cout<<"Loading..."<>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<<"===================="<>max>>low;
cout<<"Loading...";
if(max<=low) {
help();
break;
}
int n6;
myOperation.sorting();
system("cls");
color(ers.tacit);
cout<<"<返回 输入1"<>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<<"===================="<>n7;
cout<<"Loading...";
system("cls");
color(ers.frame);
cout<<"===================="<>n8;
cout<<"Loading...";
system("cls");
color(ers.frame);
cout<<"===================="<>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<<"===================="<>n01;
system("cls");
int n02;
color(ers.frame);
cout<<"===================="<>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;
}
代码制作不易,有不足之处还请见谅,别忘了加关注哦!
下期更精彩~