1. 程序执行后的部分效果 1 .1 项目主菜单效果图 1.2 初始化信息,第一次对信息的录入 1.3 添加学生信息 1.4 删除某学生信息 1.5 修改某学生信息 1.6 查询某学生信息 1.7 显示全部学生信息 源代码: /*把StudentData.cpp(源代码) 和 student.txt(数据存放处)放在同一个文件夹下*/ #include #include #include #include #include using namespace std; //最多提供 50 个学生的数据,可根据需要进行更改 const int MAX = 50; int count = 0; //用来统计学生人数 class Student { public: void Set(); //初始化信息,第一次对信息的录入 void Add(); //添加学生信息 //从磁盘读取数据以便 进行 数据的操作,方便再重写进磁盘 friend void Read(string no[],string name[],string sex[],string special[],string clas[]); int Judge(string num); //判断 num 是否在学生信息数据库中(注意它有一个参数,并且有一个 int 型的返回值) void Delete(); //删除某学生信息 void Change(); //修改某学生信息 void Search(); //查询某学生信息 void Display(); //显示全部学生信息 private: string m_no; string m_name; string m_sex; //m_ 指的是成员变量(member) string m_special; string m_clas; }; void Student::Set() { string no, name, sex, special, clas; ofstream outfile("student.txt"); //打开文件 if(!outfile) { cerr<<" open error"<>no; if(no == "0") break; //当输入的学号是 0 时,停止录入 cin>>name>>sex>>special>>clas; count++; m_no = no; outfile<