From 6a55ef7cb52a8479e26dd120107d176e7efd80a4 Mon Sep 17 00:00:00 2001 From: 0-1 <59477305+0-1Byte@users.noreply.github.com> Date: Thu, 6 May 2021 15:40:51 +0800 Subject: [PATCH] Create Attendance simulation management system.cpp --- ...ttendance simulation management system.cpp | 754 ++++++++++++++++++ 1 file changed, 754 insertions(+) create mode 100644 Curriculm design/Attendance simulation management system.cpp diff --git a/Curriculm design/Attendance simulation management system.cpp b/Curriculm design/Attendance simulation management system.cpp new file mode 100644 index 0000000..e89c590 --- /dev/null +++ b/Curriculm design/Attendance simulation management system.cpp @@ -0,0 +1,754 @@ +#include +#include +#include +#include //setw() +#include //文件管理 +using namespace std; + + +int CLASS; +static int pe; +const int tmax=200; //学生最大个数 + +//定义基类Student +class Student { + private: + friend class StudentClock_op; ///友元类 + int num; //学号 + string name; //名字 + string sex; //性别 + int grade; //出勤情况(分数体现) + int count; //缺课数 + public: + + Student(int n=0,string nam=" ",string s=" " ,int gra=0,int co=0); //构造函数 + void set(int n,string nam,string s); + void set2(int n,string nam,string s,int grade ,int count); //设置数据成员的值 + void input(); + void input2(); //s输入缺勤学生学号 //输入数据成员的值 + void output1(); + void output2(); //输出数据成员的值 + int getnum() { + return num; //获取学号 + } + string getname() { + return name; //获取姓名 + } + string getsex() { + return sex; //获取性别 + } + int getgrade () { + return grade; //获取考勤分数 + } + int getcount() { + return count; + } //获取缺课数 +}; + +//类外定义成员函数 +Student::Student(int n,string nam,string s,int gra,int co) { + num=n; + name=nam; + sex=s; + grade=gra; + count=co; +} +void Student::set(int n,string nam,string s) { + num=n; + name=nam; + sex=s; +} +void Student::set2(int n,string nam,string s,int gra,int co) { + num=n; + name=nam; + sex=s; + grade=gra; + count=co; +} +void Student::input() { + cout<<"学号:"; + cin>>num; + cout<<"姓名:"; + cin>>name; + cout<<"性别:"; + cin>>sex; +} +void Student::input2() { + cin>>num; +} + +void Student::output1() { + cout<<" 学号:"<=tmax) { + cout<<"空间已满,不能添加!!!"<>choice; + switch(choice) { + case 1: + modify_num(); + //cout<<"按学号修改."<>x1; + for(int i=0; i>h1; + for(int i=0; i>choice; + switch(choice) { + case 1: + Delete_num(); + break; + case 2: + Delete_name(); + break; + case 0: + cout<<"您已安全退出."<>f1; + for( i=0; i=top) { + cout<<"无此学生!"; + return ; + } + + cout<<"是否删除此项(是:y/Y,否:n/N):"; + cin>>c1; + if(c1=='y'||c1=='Y') { + for(int k=i; k>r; + for( i=0; i=top) { + cout<<"无此学生!"; + return ; + } + + cout<<"是否删除此项(是:y/Y,否:n/N):"; + cin>>c3; + if(c3=='y'||c3=='Y') { + for(int k=i; k>num>>name>>sex>>grade>>count ) { //这种方法可以忽略文件最后的空行,避免while(!in.eof())产生的错误 + t[i].set2(num,name,sex,grade,count ); // + i++; + } + top=i; + cout<<"读取成功!"<>choice; + switch(choice) { + case 1: + a.add(); + break; + case 2: + a.modify(); + break; + case 3: + a.total(); + break; + case 4: + a.Delete(); + break; + case 5: + a.show(); + break; + case 6: + a.save(); + break; + case 7: + a.read(); + break; + case 0: + cout<<"退出成功!"<>CLASS; + + StudentClock_op e; + e.mark(); + cout<<"#######################################"<>choice; + switch(choice) { + case 1: + start(); + break; + case 0: + cout<<"退出成功!"<>num>>name>>sex>>grade>>count) { //这种方法可以忽略文件最后的空行,避免while(!in.eof())产生的错误>>gra>>co + p[i].set2 (num,name,sex,grade,count ); // 无法读取 用set2后相当于重新设置数据成员?? + i++; + } + tot=i; + cout<<"读取成功!"<>choice; + switch(choice) { + case 1: + search_num(); + break; + case 2: + search_name(); + break; + case 0: + cout<<"您已安全退出."<>y1; + for(int i=0; i>s1; + for(int i=0; i>choice; + switch(choice) { + case 1: + c.search(); + break; + case 2: + c.total(); + break; + case 3: + c.show(); + break; + case 4: + c.read2(); + break; + case 0: + cout<<"退出成功!"<>choice; + switch(choice) { + case 1: + StudentInfoMenu(); //cout<<"您已经进入学生信息录入子系统!"<