一觉睡到2025,新的一年新的开始懒惰的我终于更新了!!
学生信息管理系统0.00.05重磅来袭!!
相较于0.00.04版此版简化了界面,增加了更多函数,希望大家能够更好的使用。
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
void cout_text(string s){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(50);
}
}
int opt;
int u;
void w_t(){
system("pause");
}
void q_s(){
system("mode con cols=70 lines=20");
mt19937 Rand(time(0));
cout_text("本系统的免责说明:\n");
cout_text("1.本系统不会有任何保密责任(包括但不限于姓名,年龄,性别)\n");
cout_text("2.若未阅读以上说明导致信息泄露本作者无任何责任!\n");
cout<<"同意并已阅读本系统的免责说明 选择 1\n";
cout<<"不同意并退出 选择 2\n";
cin>>u;
system("cls");
}
void m_l(){
cout_text("欢迎使用学生信息管理系统!\n");
cout<<"请输入要使用的功能:\n";
cout<<"1.新增学生 2.删除学生 3.查找学生 4.更改学生 5.退出\n";
cout<<"(因本作者能力有限,若本系统有bug请谅解,作者在此也表示诚挚的歉意)\n";
cin>>opt;
cout<<"\n";
}
struct Student{
string age;
string gender;
};
map<string,Student>sts;
struct x_x{
string y_w;
string x_xu;
string y_y;
};
map<string,x_x>sts_2;
void add2_x_x(const string& name,string y_w,string x_xu,string y_y){
if((sts_2[name].y_w.empty())==1&&(sts[name].age.empty())==0){
sts_2[name]={y_w,x_xu,y_y};
cout<<"已录入学生"<<name<<"的成绩。\n";
}
else if((sts_2[name].y_w.empty())==1&&(sts[name].age.empty())==1){
cout<<"系统中没有该学生!\n";
}
else{
cout<<"该学生已录入过成绩。\n";
}
}
void add_st(const string& name,string age,string gender){
if((sts[name].age.empty())==1){
sts[name]={age,gender};
cout<<"已录入学生"<<name<<"。\n";
}
else{
cout<<"该学生已被录入过!\n";
}
}
void add_x_z(const string& name){
if((sts[name].age.empty())==1){
string gr,ae;
cout<<"请输入要新增的学生年龄:";
cin>>ae;
cout<<"请输入要新增的学生性别:";
cin>>gr;
add_st(name,ae,gr);
}
else{
cout<<"请输入"<<name<<"要新增的语文成绩:";
string y_w,x_xu,y_y;
cin>>y_w;
cout<<"请输入"<<name<<"要新增的语文成绩:";
cin>>x_xu;
cout<<"请输入"<<name<<"要新增的语文成绩:";
cin>>y_y;
add2_x_x(name,y_w,x_xu,y_y);
}
w_t();
}
void erase_stn(const string& name){
if((sts[name].age.empty())==0){
sts.erase(name);
cout<<"已删除"<<name<<"。\n";
}
else{
cout<<"没有"<<name<<"这个同学。\n";
}
}
void erase_stc(const string& name){
if((sts_2[name].y_w.empty())==0){
sts_2.erase(name);
cout<<"已删除入学生"<<name<<"的成绩。\n";
}
else if((sts_2[name].y_w.empty())==1&&(sts[name].age.empty())==1){
cout<<"系统中没有该学生!\n";
}
}
void erase_x_z(const string &name){
if((sts[name].age.empty())==0&&(sts_2[name].y_w.empty())==0){
cout<<"请问你要"<<name<<"删除哪个方面?\n1.所有\n2.只删除成绩\n";
int ij;
cin>>ij;
if(ij==1){
erase_stc(name);
erase_stn(name);
}
else{
erase_stc(name);
}
}
else{
erase_stn(name);
}
w_t();
}
void cx_cj(const string& name){
cout<<name<<"的语文成绩是:"<<sts_2[name].y_w<<"分。\n";
cout<<name<<"的数学成绩是:"<<sts_2[name].x_xu<<"分。\n";
cout<<name<<"的英语成绩是:"<<sts_2[name].y_y<<"分。\n";
}
void cx_st(const string& name){
if((sts[name].age.empty())==0){
cout<<name<<"是"<<sts[name].age<<"岁,是一个"<<sts[name].gender<<"\n\n";
}
else{
cout<<"没有"<<name<<"这个同学。\n";
}
}
void cx_x_z(const string& name){
if((sts_2[name].y_w.empty())==0){
cx_st(name);
cx_cj(name);
}
else if((sts_2[name].y_w.empty())==1&&(sts[name].age.empty())==0){
cx_st(name);
}
else{
cout<<"没有"<<name<<"这名学生!\n";
}
w_t();
}
void ce_x_x(const string& name,string y_w,string x_xu,string y_y){
sts_2[name]={y_w,x_xu,y_y};
cout<<"已更改"<<name<<"的成绩。";
}
void ce_st(const string& name,string age){
if((sts[name].age.empty())==0){
sts[name].age=age;
}
else{
cout<<"没有"<<name<<"这个同学。\n";
cout<<"所以无法更改!";
}
}
void ce_x_z(const string& name){
if((sts_2[name].y_w.empty())==1){
string ae;
cout<<"请输入要更改的学生年龄:";
cin>>ae;
ce_st(name,ae);
}
else{
cout<<"请问您要更改"<<name<<"的那个方面?\n1.全部(年龄、成绩)\n2.只改年龄\n3.只改成绩\n";
int x_z;
cin>>x_z;
if(x_z==1){
string ae,y_w,x_xu,y_y;
cout<<"请输入要更改的学生年龄:";
cin>>ae;
cout<<"请输入要更改的学生语文成绩:";
cin>>y_w;
cout<<"请输入要更改的学生数学成绩:";
cin>>x_xu;
cout<<"请输入要更改的学生英语成绩:";
cin>>y_y;
ce_st(name,ae);
ce_x_x(name,y_w,x_xu,y_y);
}
else if(x_z==2){
string ae;
cout<<"请输入要更改的学生年龄:";
cin>>ae;
ce_st(name,ae);
}
else{
string y_w,x_xu,y_y;
cout<<"请输入要更改的学生语文成绩:";
cin>>y_w;
cout<<"请输入要更改的学生数学成绩:";
cin>>x_xu;
cout<<"请输入要更改的学生英语成绩:";
cin>>y_y;
ce_x_x(name,y_w,x_xu,y_y);
}
}
w_t();
}
int o;
void print_begin(){
srand(time(NULL));
string beginmap[20]={
{"▉ "},
{"▉▉ "},
{"▉▉▉ "},
{"▉▉▉▉ "},
{"▉▉▉▉▉ "},
{"▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ "},
{"▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉"}
};
for(int i=0;i<20;i++){
system("cls");
cout<<" ___ ___ ___ _ _ ___ | "<<"\n";
cout<<" \\ /\\ /|__ | | | | |\/| |__ | "<<"\n";
cout<<" \\/ \\/ |___ |__ |___ |___| | | |___ . "<<"\n\n";
cout<<"\n\n 名称:学生信息管理系统!!!\n\n ";
cout<<" -----------------------------------------\n"<<" | ";
cout<<beginmap[i]<<" |\n -----------------------------------------\n\n";
cout<<" 作者:至尊枪神 ";
Sleep(rand()%500);
}
Sleep(500);
system("cls");
}
void by(){
system("cls");
cout<<" ___ ___ ___ _ _ ___ | "<<"\n";
cout<<" \\ /\\ /|__ | | | | |\/| |__ | "<<"\n";
cout<<" \\/ \\/ |___ |__ |___ |___| | | |___ . "<<"\n\n";
cout<<" 欢迎下次使用!\n";
}
void x_z(){
system("cls");
cout<<"请输入要增加的学生个数:";
cin>>o;
system("cls");
while(o--){
cout<<"请输入要新增的学生姓名:";
string ne;
cin>>ne;
add_x_z(ne);
system("cls");
}
}
void s_c(){
system("cls");
cout<<"请输入要删除的学生个数:";
cin>>o;
system("cls");
while(o--){
string ne;
cout<<"请输入要删除的学生姓名:";
cin>>ne;
cout<<"\n";
erase_x_z(ne);
system("cls");
}
}
void c_x(){
system("cls");
cout<<"请输入要查找的学生个数:";
cin>>o;
system("cls");
while(o--){
string ne;
cout<<"请输入要查找的学生姓名:";
cin>>ne;
cout<<"\n";
cx_x_z(ne);
Sleep(2000);
system("cls");
}
}
void g_g(){
system("cls");
cout<<"请输入要的更改学生个数:";
cin>>o;
system("cls");
while(o--){
string ne,ae;
cout<<"请输入要更改的学生姓名:";
cin>>ne;
cout<<"\n";
cout<<"请输入要更改的学生年龄:";
cin>>ae;
cout<<"\n";
ce_st(ne,ae);
Sleep(2000);
system("cls");
}
}
void t_c_1(){
system("cls");
cout<<"确定退出么?\n";
cout<<"1.确定;2.我再想想\n";
cin>>opt;
}
void t_c_2(){
system("cls");
cout_text("谢谢使用学生信息管理系统orz\n");
w_t();
by();
exit(0);
}
void t_c_3(){
system("cls");
cout<<"欢迎回来!!";
system("color E1");
Sleep(10);
system("color A1");
Sleep(10);
system("color B1");
Sleep(10);
system("color 21");
Sleep(10);
system("color 51");
Sleep(10);
system("color 01");
Sleep(10);
system("color 31");
Sleep(10);
system("color 21");
Sleep(10);
system("color F1");
system("cls");
}
signed man(){
system("color F1");
print_begin();
q_s();
if(u==1){
while(1){
m_l();
if(opt==1){
x_z();
}
else if(opt==2){
s_c();
}
else if(opt==3){
c_x();
}
else if(opt==4){
g_g();
}
else if(opt==5){
t_c_1();
if(opt==1){
t_c_2();
}
else{
t_c_3();
continue;
}
}
}
}
else{
t_c_2();
}
return 0;
}
signed main(){
man();
return 0;
}