STUDENT SYSTEM

 

 

#include <bits/stdc++.h>
using namespace std;
struct student{
    int id;
    string name;
    int age;
    int grade;
}s;
void zjm()
{
    cout<<"Welcome to the Student Management System!"<<endl;
    cout<<"Please make the following choices"<<endl;
    cout<<"ONE New Student Information"<<endl;
    cout<<"TWO Search for student information"<<endl;
    cout<<"THREE Modify student information"<<endl;
    cout<<"FOUR Delete student information"<<endl;
    cout<<"FIVE Exit student information"<<endl;
}
void TWO_fjm()
{
    cout<<"Choose the method you want to search for:"<<endl;
    cout<<"ONE Find Student ID number"<<endl;
    cout<<"TWO Find Student Age"<<endl;
    cout<<"THREE Find Student Name"<<endl;
    cout<<"FOUR Find Student Grade"<<endl;
    cout<<"FIVE Return Main interface"<<endl;
}
void THREE_ONE_fjm()
{
    cout<<"Please cin student id"<<endl;
    cout<<"TWO   Return Main interface"<<endl;
}
int main(){
    vector<student> a;

    string NUM;
    while(true)
    {
        zjm();
        cin>>NUM;
        if(NUM=="ONE"){
            if(s.id==0)
        {        
            s.id=1000;
        }else{
            s.id+=1;
        }
        cin>>s.name>>s.age>>s.grade;
        cout<<"Your's ID is " << s.id <<endl;
        a.push_back(s);
        
        }
        if(NUM=="TWO")
        {
            int f=0;
           while(1)
           {
               if(f==0)
            {
                system("cls");
            }
            f++;
            fjm();
            string Index;
            cin>>Index;
            if(Index=="FIVE")
            {
                system("cls");
                break;
            }
        bool information=false;
        if(Index=="ONE")
        {
            int ID;
            cout<<"Please enter the card number you are looking for"<<endl;
            cin>>ID;
        
        for(int i=0;i<a.size();i++)
        {
            
            if(a[i].id==ID){
            
                information=true;
                cout<<"Student Name:"<<a[i].name<<endl;
                cout<<"Student Age:"<<a[i].age<<endl;
                cout<<"Student Drage:"<<a[i].grade<<endl;
                break;
            }
            if(information=false)
            {
                cout<<"what a pity!I can not find."<<endl;
                break;
                }
            }
        
        }
        if(Index=="TWO")
        {
            int ID;
            cout<<"Please enter the Age you are looking for"<<endl;
            cin>>ID;
            for(int i=0;i<a.size();i++)
            {
            
            if(a[i].age==ID){
            
                information=true;
                cout<<"Student ID:"<<a[i].id<<endl;
                cout<<"Student name:"<<a[i].name<<endl;
                cout<<"Student Grade:"<<a[i].grade<<endl;
                break;
            }
            if(information=false)
            {
                cout<<"what a pity!I can not find."<<endl;
                break;
                }
            }
        
        }
         if(Index=="THREE")
        {
            string ID;
            cout<<"Please enter the Name you are looking for"<<endl;
            cin>>ID;
            for(int i=0;i<a.size();i++)
            {
            
            if(a[i].name==ID){
            
                information=true;
                cout<<"Student ID:"<<a[i].id<<endl;
                cout<<"Student Age:"<<a[i].age<<endl;
                cout<<"Student Grade:"<<a[i].grade<<endl;
                
                break;
            }
            if(information=false)
            {
                cout<<"what a pity!I can not find."<<endl;
                break;
                }
            }
        }
        if(Index=="FOUR")
        {
            int ID;
            cout<<"Please enter the Grade you are looking for"<<endl;
            cin>>ID;
            for(int i=0;i<a.size();i++)
            {
            
            if(a[i].grade==ID){
            
                information=true;
                cout<<"Student ID:"<<a[i].id<<endl;
                cout<<"Student name:"<<a[i].name<<endl;
                cout<<"Student Age:"<<a[i].age<<endl;
                break;
            }
            if(information=false)
            {
                cout<<"what a pity!I can not find."<<endl;
                break;
                }
            }
        
        }
            }        
        }
        if(NUM=="THREE")
        {
            system("cls");
            while(1)
            {
                THREE_ONE_fjm();
                int g = 0;
                cin >> g ;
                if
                
            }
        }
        
    }
    return 0;
}

 


if(information=false)
{
cout<<"what a pity!I can not find."<<endl;
break;
}
}

}
}
}
if(NUM=="THREE")
{
system("cls");
while(1)
{
THREE_ONE_fjm();
int g = 0;
cin >> g ;
if

}
}

}
return 0;
}

posted @ 2023-12-22 20:01  hanxuyao  阅读(36)  评论(0)    收藏  举报