学生管理系统

发布时间 2023-12-16 10:02:56作者: 王一行(小号)
#include <iostream>
#include <vector>
using namespace std;
struct a{
    string name;
    int id;
    int age;
    string Class;
    int number;
}index;
void MAIN(){
    cout<<"欢迎使用学生管理系统"<<endl
        <<"***1.新建学生信息***"<<endl
        <<"***2.查找学生信息***"<<endl
        <<"***3.修改学生信息***"<<endl
        <<"***4.删除学生信息***"<<endl
        <<"***5.退出管理系统***"<<endl;
}
vector<a> no1(vector<a> x);
vector<a> no2(vector<a> x);
int main(){
    vector<a>x;
    int n;
    while(1){
        MAIN();
        cin>>n;
        if(n>5){
            system("cls");
            continue;
        }else if(n==5){
            system("pause");
            break;
        }
        switch(n){
            case 1:
                no1(x);
                break;
            case 2:
                no2(x);
                break;
        }
        system("pause");
        system("cls");
    }
    return 0;
}
vector<a> no1(vector<a> x){
    cout<<"请输入你的姓名:";
    cin>>index.name;
    cout<<"请输入你的年龄:";
    cin>>index.age;
    cout<<"请输入你的班级:";
    cin>>index.Class;
    index.id = 1000+index.number;
    cout<<"你的学号是:"<<index.id<<endl;
    index.number++;
    x.push_back(index);
    return x;
}
vector<a> no2(vector<a> x){
    cout<<"请选择您要查找的方式:"<<endl
        <<"***1.根据学号查询***"<<endl
        <<"***2.根据姓名查询***"<<endl
        <<"***3.根据班级查询***"<<endl;
    return x;
}