学生管理系统的源代码

博客展示了学生管理系统的代码,涉及数据库相关内容,标签包含 MySQL、数据库和 SQL,推测代码可能与数据库操作有关,用于实现学生管理系统的各项功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

**

学生管理系统

**
代码如下:

#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<fstream>
using namespace std;
class Info
{
public:
    char num[20];//学号
    string name;//姓名
    string sex;//性别
    string age;//年龄
    string jiguan;//籍贯
    string xibie;//系别
    string zhuanye;//专业
    string banji;//班级
    string phonenum;//电话
    string pingjia;//评价
};
 
class Ave:public Info
{
private:
    int English;
    int gaoshu;
    int mima;
    int chengxusheji;
    int wuli;
    int lisan;
    int totalave;
public:
    Ave(int E, int g, int m, int c, int w, int l,int t);
    friend int ave(Ave &a);
    Ave();
    friend class Menu;
 
};
class Menu
{
public:
    void LandingPassword();//登陆
    void Append();//增加
    void Modify();//修改
    void Display();//显示
    void Search();//查询
    void Delete();//删除
    void ChengjiDisplay();//显示各科成绩
    void Chengjichaxun();//成绩查询
 
};
 
int ave(Ave &a)
{
    a.totalave=int((a.English+a.gaoshu+a.mima+a.chengxusheji+a.wuli+a.lisan)/6);
    return a.totalave;
}
Ave::Ave()
{
    totalave=0;
    English=0;
    gaoshu=0;
    mima=0;
    chengxusheji=0;
    wuli=0;
    lisan=0;
    totalave=0;
}
 
Ave::Ave(int E, int g, int m, int c, int w, int l,int t)
{
    totalave=t;
    English=E;
    gaoshu=g;
    mima=m;
    chengxusheji=c;
    wuli=w;
    lisan=l;
}
 
int menu()  //菜单选择函数
{
    int n;  //n记录选择的菜单
    system("cls");//清屏
    cout<<"\t\t\t\t***@**@**@**@**@***目      录**@**@**@**@**@**@**@***"<<endl;
    cout<<"\t\t\t\t "<<endl;
    cout<<"\t\t\t\t              *---1.学生信息输入--  "<<endl;//输入
    cout<<"\t\t\t\t       *----------2.学生信息显示-- "<<endl; // 显示                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ")
    cout<<"\t\t\t\t  *---------------3.学生信息查询-- "<<endl;// 查找
    cout<<"\t\t\t\t           *------4.学生信息修改--    "<<endl;// 修改
    cout<<"\t\t\t\t              *---5.学生信息删除--  "<<endl;// 删除
    cout<<"\t\t\t\t        *---------6.学生成绩显示--  "<<endl;// 成绩显示
    cout<<"\t\t\t\t            *-----7.学生成绩查询--  "<<endl;// 成绩查询
    cout<<"\t\t\t\t      *---------- 8.退出系统-- "<<endl;//  选择
    cout<<"\t\t\t\t  "<<endl;
    cout<<"\t\t\t\t\tChoose your number(1-8):[ ]\b\b";
    while(1)
    {
        cin>>n;
        getchar();
        if(n<1&&n>8)
            cout<<"\t\t\t\t\tInput error,please input again(1-8):[ ]\b\b";
        else
            break;
    }
    return n;
}
 
void print1()   ////学生信息输出函数
{
    system("color f5");
    cout<<"\t学号"<<"\t\t姓名  "<<"\t性别  "<<"\t年龄  "<<"\t籍贯  ";
    cout<<"\t系别  "<<"\t专业  "<<"\t班级  "<<"\t电话号码 "<<"\t学期总评"<<endl;
}
void print2()////学生成绩输出
{
    system("color f5");
    cout<<"\t学号"<<"\t\t姓名"<<"\t英语"<<"\t高数"<<"\t密码学";
    cout<<"\tC++"<<"\t物理"<<"\t离散"<<"\t平均分"<<"\t学期总评"<<endl;
}
void Menu::Append() //学生信息输入
{
    system("color f4");
    Info x;
    Ave y;
    ofstream ofile("inform.txt",ios::out|ios::app);
    ifstream ifile("inform.txt",ios::in);
    ofstream sfile("chengji.txt",ios::out|ios::app);
    string q_name,q_num,q_sex,q_jiguan,q_xibie,q_zhuanye,q_age,q_banji,q_phonenum,q_pingjia;
    // double c_English,c_gaoshu,c_mima,c_chengxusheji,c_wuli,c_lisan;
    char f;
    if(!ofile||!sfile)  //判断文件是否为空
    {
        cout<<"\t\t\t\t\tCan not open the file"<<endl;
        getch();    //不回显字符,不需按回车键,等所有输入完毕再输出
        exit(1);
    }
    do
    {
        cout<<"\t\t\t\t学号:";
        cin>>x.num;
        while(!ifile.eof())
        {
            q_num="";
            ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
            if(q_num.length()==0)
                break;
            while(x.num==q_num)
            {
                cout<<"\n\n\t\tThe number you entered already exists,please input again! \n\n"<<endl;
                cout<<"\t\t\t\t学号:";
                cin>>x.num;
            }
 
        }
        cout<<"\t\t\t\t姓名:";
        cin>>x.name;
        cout<<"\t\t\t\t性别(male or female):";
        cin>>x.sex;
        cout<<"\t\t\t\t年龄:";
        cin>>x.age;
        cout<<"\t\t\t\t籍贯:";
        cin>>x.jiguan;
       // cout<<"\t\t\t\t系别:";
        x.xibie="计算机";
        cout<<"\t\t\t\t专业:";
        cin>>x.zhuanye;
        cout<<"\t\t\t\t班级:";
        cin>>x.banji;
        cout<<"\t\t\t\t电话号码:";
        cin>>x.phonenum;
        cout<<"\t\t\t\t请输入该学生在这一学期各科成绩:\n"<<endl;
        cout<<"\t\t\t\t英语成绩:";
        cin>>y.English;
        cout<<"\t\t\t\t高数成绩:";
        cin>>y.gaoshu;
        cout<<"\t\t\t\t密码学成绩:";
        cin>>y.mima;
        cout<<"\t\t\t\tC++成绩:";
        cin>>y.chengxusheji;
        cout<<"\t\t\t\t大学物理成绩:";
        cin>>y.wuli;
        cout<<"\t\t\t\t离散成绩:";
        cin>>y.lisan;
        int _ave=ave(y);
        if(_ave==0)
            x.pingjia="无成绩";
        else if(_ave<60&&_ave>0)
            x.pingjia="不及格";
        else if(_ave<75&&_ave>=60)
            x.pingjia="及格";
        else if(_ave<85&&_ave>=75)
            x.pingjia="良好";
        else if(_ave<=100&&_ave>=85)
            x.pingjia="优秀";
        fflush(stdin);                     //标准输入
        cout<<"\t\t\t\t\tAny more?(Y/N):[ ]\b\b";
        f=getchar();
        getchar();
        /*
        将数据存入文件
        */
        ofile<<x.num<<"\t"<<x.name<<"\t"<<x.sex<<"\t"<<x.age<<"\t"<<x.jiguan<<"\t"<<x.xibie<<"\t"<<x.zhuanye<<"\t"<<x.banji<<"\t "<<x.phonenum<<"\t "<<x.pingjia<<endl;
        sfile<<x.num<<"\t"<<x.name<<"\t"<<y.English<<"\t"<<y.gaoshu<<"\t"<<y.mima<<"\t"<<y.chengxusheji<<"\t"<<y.wuli<<"\t"<<y.lisan<<"\t"<<_ave<<"\t"<<x.pingjia<<endl;
    }
    while(f=='Y'||f=='y');
 
    ofile.close();   //文件关闭
    sfile.close();
}
 
void Menu::Display()//学生信息显示函数
{
    system("color f0");
    ifstream ifile("inform.txt",ios::in);
    string q_name,q_num,q_sex,q_jiguan,q_xibie,q_zhuanye,q_age,q_banji,q_phonenum,q_pingjia;
    int total=0;
    if(!ifile)
    {
        cout<<"\t\t\t\t\tCan not open the inform file!"<<endl;
        getch();
        exit(1);
    }
    while(!ifile.eof())//将所输入的数据作为整体一次性读出来
    {
        q_num="";
        ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
        if(q_num.length()==0)
            break;
        total++;      //记录有多少组数据
        if(total==1) print1();
        cout<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
    }
    ifile.close();
    cout<<"\n\n\t\t\t\t\tThere are "<<total<<" record in all!"<<endl;
    cout<<"\n\n\t\t\t\t\tPress any key to continue......";
    getch();
}
 
void  Menu::Search()//学生信息查询函数
{
    system("color f6");
    ifstream ifile("inform.txt",ios::in);
    string q_name,q_num,q_sex,q_jiguan,q_xibie,q_zhuanye,q_age,q_banji,q_phonenum,q_pingjia;
    int flag;
    int total;
    string ch;
    char f;
    if(!ifile)
    {
        cout<<"\t\t\t\t\tCan not open the inform file!"<<endl;
        exit(0);
        getch();
    }
    do
    {
        cout<<"\n\n\t\t\t\t\tSearch by(1:number  2:name 3:jiguan):[ ]\b\b";
        cin>>flag;
        while(1)
        {
            if(flag<1||flag>3)
            {
                cout<<"\t\t\t\t\tInput error,please input again(1:number 2:name 3:jiguan):[ ]\b\b";
                cin>>flag;
            }
            else
                break;
        }
        if(flag==1)   //按编号查询
        {
 
            cout<<"\t\t\t\t\tPlease input the num you want to search:";
            cin>>ch;
            total=0;
            while(!ifile.eof())
            {
                q_num="";
                ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
                if(q_num.length()==0)
                    break;
                if(ch==q_num)
                {
                    total++;
                    if(total==1) print1();
                    cout<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
                }
 
            }
        }
        else if(flag==2) // 按名字查询
        {
            cout<<"\t\t\t\t\tPlease input the name you want to search:";
            cin>>ch;
            total=0;
            while(!ifile.eof())
            {
                q_num="";
                ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
                if(q_num.length()==0)
                    break;
                if(ch==q_name)
                {
                    total++;
                    if(total==1) print1();
                    cout<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
                }
 
            }
        }
        else
        {
            cout<<"\t\t\t\t\tPlease input the jiguang you want to search:";
            cin>>ch;
            total=0;
            while(!ifile.eof())
            {
                q_num="";
                ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
                if(q_num.length()==0)
                    break;
                if(ch==q_jiguan)
                {
                    total++;
                    if(total==1) print1();
                    cout<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
                }
            }
        }
        cout<<"\n\n\t\t\t\t\tThere are "<<total<<" record included!"<<endl;
        cout<<"\t\t\t\t\tSearch any more?(Y/N):[ ]\b\b";
        cin>>f;
        ifile.close();
        ifile.open("inform.txt",ios::in);
    }
    while(f=='Y'||f=='y');
    ifile.close();
}
 
void Menu::Modify()  //学生信息修改函数
{
    system("color f1");
    Info x;
    string q_name,q_num,q_sex,q_jiguan,q_xibie,q_zhuanye,q_age,q_banji,q_phonenum,q_pingjia;
    int c_English,c_gaoshu,c_mima,c_chengxusheji,c_wuli,c_lisan,c_ave;
    string c_num,c_name,c_pingjia;
    int flag;
    string ch;
    char ok;
        fstream ifile("inform.txt",ios::in|ios::out);
        fstream ofile("temp.txt",ios::in|ios::out|ios::trunc);
        fstream sfile("chengji.txt",ios::in|ios::out);
        fstream rfile("xiuchu.txt",ios::in|ios::out|ios::trunc);
        if(!ifile)
        {
            cout<<"\t\t\t\t\tCan not open inform file!"<<endl;
            getch();
            exit(0);
        }
        if(!ofile)
        {
            cout<<"\t\t\t\t\tCan not open temp file!"<<endl;
            getch();
            exit(0);
        }
        if(!sfile)
        {
            cout<<"\t\t\t\t\tCan not open chengji file!"<<endl;
            getch();
            exit(0);
        }
        if(!rfile)
        {
            cout<<"\t\t\t\t\tCan not open xiuchu file!"<<endl;
            getch();
            exit(0);
        }
        cout<<"\t\t\t\t\tPlease input the num you want to modify:";
        cin>>ch;
        while(!ifile.eof())
        {
            q_num="";
             sfile>>c_num>>c_name>>c_English>>c_gaoshu>>c_mima>>c_chengxusheji>>c_wuli>>c_lisan>>c_ave>>c_pingjia;
            ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
            if(q_num.length()==0)
                break;
            if(ch==q_num)
            {
 
                print1();
                cout<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
                fflush(stdin);////////////********************
                cout<<"\t\t\t\t\t\t确定要修改此人?(Y/N):[ ]\b\b";
                cin>>ok;
                fflush(stdin);///////*******************
                if(ok=='y'||ok=='Y')
                {
                    cout<<"\n\n\t\t\t\t\tPlease input the new information:"<<endl;
                    cout<<"\t\t\t\t学号:";
                    cin>>q_num;
                    cout<<"\t\t\t\t姓名:";
                    cin>>q_name;
                    cout<<"\t\t\t\t性别(male or female):";
                    cin>>q_sex;
                    cout<<"\t\t\t\t年龄:";
                    cin>>q_age;
                    cout<<"\t\t\t\t籍贯:";
                    cin>>q_jiguan;
                    cout<<"\t\t\t\t系别:";
                    q_xibie="计算机";
                    cout<<"\t\t\t\t专业:";
                    cin>>q_zhuanye;
                    cout<<"\t\t\t\t班级:";
                    cin>>q_banji;
                    cout<<"\t\t\t\t电话号码:";
                    cin>>q_phonenum;
                    flag=1;
                }
            }
            rfile<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<c_English<<"\t"<<c_gaoshu<<"\t"<<c_mima<<"\t"<<c_chengxusheji<<"\t"<<c_wuli<<"\t"<<c_lisan<<"\t"<<c_ave<<"\t"<<c_pingjia<<endl;
            ofile<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
        }
    ifile.close();
    ofile.close();
        rfile.close();
    sfile.close();
        if(flag==1)
        {
            cout<<"\t\t\t\tModify sucess!"<<endl;
            system("del inform.txt");
            system("rename temp.txt,inform.txt");
            system("del chengji.txt");
            system("rename xiuchu.txt,chengji.txt");
        }
        else
            cout<<"\t\t\t\t\tCan not find this record!"<<endl;
 
            getch();
    }
 
void Menu::Delete()  //学生信息删除函数
{
    system("color f3");
    fstream ifile("inform.txt",ios::in);
    fstream ofile("temp.txt",ios::in|ios::out|ios::trunc);
    fstream sfile("chengji.txt",ios::in);
    fstream rfile("shanchu.txt",ios::in|ios::out|ios::trunc);
    string q_name,q_num,q_sex,q_jiguan,q_xibie,q_zhuanye,q_age,q_banji,q_phonenum,q_pingjia;
    int c_English,c_gaoshu,c_mima,c_chengxusheji,c_wuli,c_lisan,c_ave;
    string c_num,c_name,c_pingjia;
    int flag;
    string ch;
    char f,a;
     if(!ifile)
        {
            cout<<"\t\t\t\t\tCan not open the inform file!"<<endl;
            getch();
            exit(0);
        }
        if(!ofile)
        {
            cout<<"\t\t\t\t\tCan not creat the temp file!"<<endl;
            getch();
            exit(0);
        }
        if(!sfile)
        {
            cout<<"\t\t\t\t\tCan not creat the chengji file!"<<endl;
            getch();
            exit(0);
        }
        if(!rfile)
        {
             cout<<"\t\t\t\t\tCan not creat the shanchu file!"<<endl;
            getch();
            exit(0);
        }
        cout<<"\t\t\t\t\tPlease input the num you want to delete:";
        cin>>ch;
        flag=0;
        while(!ifile.eof())
        {
            q_num="";
            sfile>>c_num>>c_name>>c_English>>c_gaoshu>>c_mima>>c_chengxusheji>>c_wuli>>c_lisan>>c_ave>>c_pingjia;
            ifile>>q_num>>q_name>>q_sex>>q_age>>q_jiguan>>q_xibie>>q_zhuanye>>q_banji>>q_phonenum>>q_pingjia;
             if(q_num.length()==0)
                break;
            if(q_num==ch)
            {
                print1();
                cout<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
                flag=1;
                cout<<"!!!!!!!!"<<endl;
            }
            else
            {
                cout<<"!!!!!!!!"<<endl;
               rfile<<"\t"<<c_num<<"\t"<<c_name<<"\t"<<c_English<<"\t"<<c_gaoshu<<"\t"<<c_mima<<"\t"<<c_chengxusheji<<"\t"<<c_wuli<<"\t"<<c_lisan<<"\t"<<c_ave<<"\t"<<c_pingjia<<endl;
               ofile<<"\t"<<q_num<<"\t"<<q_name<<"\t"<<q_sex<<"\t"<<q_age<<"\t"<<q_jiguan<<"\t"<<q_xibie<<"\t"<<q_zhuanye<<"\t"<<q_banji<<"\t"<<q_phonenum<<"\t"<<q_pingjia<<endl;
            }
        }
        ifile.close();
        ofile.close();
        sfile.close();
        rfile.close();
        if(flag==1)
        {
            cout<<"\t\t\t\tDelete sucess!"<<endl;
            system("del inform.txt");
            system("rename temp.txt,inform.txt");
            system("del chengji.txt");
            system("rename shanchu.txt,chengji.txt");
        }
        else
            cout<<"\t\t\t\t\tCan not find this record!"<<endl;
        fflush(stdin);
        getch();
 
}
 
void Menu::ChengjiDisplay()////显示所有人各科成绩
{
    system("color f0");
    ifstream ifile("chengji.txt",ios::in);
    int c_English,c_gaoshu,c_mima,c_chengxusheji,c_wuli,c_lisan,c_ave;
    string c_num,c_name,c_pingjia;
    int total=0;
    if(!ifile)
    {
        cout<<"\t\t\t\t\tCan not open the inform file!"<<endl;
        getch();
        exit(1);
    }
    while(!ifile.eof())//将所输入的数据作为整体一次性读出来
    {
        c_num="";
        ifile>>c_num>>c_name>>c_English>>c_gaoshu>>c_mima>>c_chengxusheji>>c_wuli>>c_lisan>>c_ave>>c_pingjia;
        if(c_num.length()==0)
            break;
        total++;      //记录有多少组数据
        if(total==1) print2();
        cout<<"\t"<<c_num<<"\t"<<c_name<<"\t"<<c_English<<"\t"<<c_gaoshu<<"\t"<<c_mima<<"\t"<<c_chengxusheji<<"\t"<<c_wuli<<"\t"<<c_lisan<<"\t"<<c_ave<<"\t"<<c_pingjia<<endl;
    }
    ifile.close();
    cout<<"\n\n\t\t\t\t\tThere are "<<total<<" record in all!"<<endl;
    cout<<"\n\n\t\t\t\t\tPress any key to continue......";
    getch();
 
}
 
void Menu::Chengjichaxun()//个人成绩查询
{
    system("color f6");
    ifstream sfile("chengji.txt",ios::in);
    int c_English,c_gaoshu,c_mima,c_chengxusheji,c_wuli,c_lisan,c_ave;
    string c_num,c_name,c_pingjia;
    int flag;
    int total;
    string ch;
    char f;
    if(!sfile)
    {
        cout<<"\t\t\t\t\tCan not open the chengji file!"<<endl;
        exit(0);
        getch();
    }
    do
    {
        cout<<"\n\n\t\t\t\t\tSearch by(1:number  2:name):[ ]\b\b";
        cin>>flag;
        while(1)
        {
            if(flag<1||flag>2)
            {
                cout<<"\t\t\t\t\tInput error,please input again(1:number 2:name):[ ]\b\b";
                cin>>flag;
            }
            else
                break;
        }
        if(flag==1)   //按编号查询
        {
            cout<<"\t\t\t\t\tPlease input the num you want to search:";
            cin>>ch;
            total=0;
            while(!sfile.eof())
            {
                c_num="";
                sfile>>c_num>>c_name>>c_English>>c_gaoshu>>c_mima>>c_chengxusheji>>c_wuli>>c_lisan>>c_ave>>c_pingjia;
                if(c_num.length()==0)
                    break;
                if(ch==c_num)
                {
                    total++;
                    if(total==1) print2();
                    cout<<"\t"<<c_num<<"\t"<<c_name<<"\t"<<c_English<<"\t"<<c_gaoshu<<"\t"<<c_mima<<"\t"<<c_chengxusheji<<"\t"<<c_wuli<<"\t"<<c_lisan<<"\t"<<c_ave<<"\t"<<c_pingjia<<endl;
                }
 
            }
        }
        else  // 按名字查询
        {
            cout<<"\t\t\t\t\tPlease input the name you want to search:";
            cin>>ch;
            total=0;
            while(!sfile.eof())
            {
                c_num="";
                sfile>>c_num>>c_name>>c_English>>c_gaoshu>>c_mima>>c_chengxusheji>>c_wuli>>c_lisan>>c_ave>>c_pingjia;
                if(c_num.length()==0)
                    break;
                if(ch==c_name)
                {
                    total++;
                    if(total==1) print2();
                    cout<<"\t"<<c_num<<"\t"<<c_name<<"\t"<<c_English<<"\t"<<c_gaoshu<<"\t"<<c_mima<<"\t"<<c_chengxusheji<<"\t"<<c_wuli<<"\t"<<c_lisan<<"\t"<<c_ave<<"\t"<<c_pingjia<<endl;
                }
 
            }
        }
        cout<<"\n\n\t\t\t\t\tThere are "<<total<<" record included!"<<endl;
        cout<<"\t\t\t\t\tSearch any more?(Y/N):[ ]\b\b";
        cin>>f;
        sfile.close();
        sfile.open("chengji.txt",ios::in);
    }
    while(f=='Y'||f=='y');
    sfile.close();
}
 
void Menu::LandingPassword()//学生信息登陆界面
{
    char passWord[10];
    char ch;
    int i,j;
 
    for(i=1; i<=3; i++)
    {
 
        j=0;
        cout<<"\n\n\n\n\n\n\n\n\n\n"<<endl;
        cout<<"\t\t\t\t\t欢迎来到计科学生信息管理系统"<<endl;
        cout<<"\t\t\t\t\t请输入计科学生信息管理系统密码:";
        while(j<10&&(ch=getch())!='\r')////输入密码
        {
            passWord[j++]=ch;  ////将输入的密码存入数组中
            putchar('*');     ////每输入一个密码,输出一个*号
        }
        passWord[j]='\0';
        if(strcmp(passWord,"123456")==0)  //密码
        {
            system("cls"); ////清屏
            cout<<"\n\n\n\n\n\n\n";
            cout<<"\t\t\t\t\t|----------------------------------------|"<<endl;
            cout<<"\t\t\t\t\t|                                        |"<<endl;
            cout<<"\t\t\t\t\t|                                        |"<<endl;
            cout<<"\t\t\t\t\t|      欢迎使用计科学生信息管理系统      |"<<endl;
            cout<<"\t\t\t\t\t|                                        |"<<endl;
            cout<<"\t\t\t\t\t|                                        |"<<endl;
            cout<<"\t\t\t\t\t|----------------------------------------|"<<endl;
            getch();
            break;
        }
        else
        {
            cout<<"\n\t\t\t\t密码错误,请重新输入!"<<endl;
        }
    }
    system("cls");
    if(i>3)
    {
        cout<<"\n\n\n\nn\n\n\n\n"<<endl;
        cout<<"\n\t\t\t\t密码已经输入3次,您无权使用,请退出!"<<endl;
        getch();
        exit(0);
    }
 
};
int main()//主函数
{
    system("color f3");   //控制整个系统的字体颜色
    Menu m;
     m.LandingPassword();
    while(1)
    {
        switch(menu())
        {
        case 1:
            m.Append();
            break;
        case 2:
            m.Display();
            break;
        case 3:
            m.Search();
            break;
        case 4:
            m.Modify();
            break;
        case 5:
            m.Delete();
            break;
        case 6:
            m.ChengjiDisplay();
            break;
        case 7:
            m.Chengjichaxun();
            break;
        case 8:
            exit(0);
            break;
            return 0;
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

与君归

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值