学生评教管理系统_学生在线评价管理系统
学生评教管理系统由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“学生在线评价管理系统”。
#include #include #include #include #include #include using namespace std;int s=0;int u=0;cla teacher;cla student { public: void resetsno(int);void inputst(char * ,char *,int,int,char *,long);void outputst(int);int checkst(int);void findst(int);void deletest(int);
void resortst(int);void coverst(int);int getsno(int);void leoninput(int);int outtofile1(int);student student::operator=(student &s1);double value(teacher &te);protected: char name[20];char sex[20];int age;int sno;long tel;char banji[50];char leon[10][50];//用二维的字符数组存储学生所学的课程
};cla teacher { public: double resetscore(double,int);teacher teacher::operator=(teacher &t1);void resetworkno(int);void inputte(char *,char *,int,char *,char *,int);void outputte(int);
int checkte(int);void findte(int);void deletete(int);void resortte(int);void resort(int);void coverte(int);int getworkno(int);int outtofile2(int);double getscore(int);friend double student::value(teacher &te);//友元成员。声明类student的value作为类teacher的友元函数。protected: char name[20];char sex[20];int age;int workno;char les[50];char dep[50];double score;};student stu[50];teacher tea[10];int student::getsno(int s){ return stu[s].sno;} void student::resetsno(int s){ cin>>stu[s].sno;} student student::operator=(student &s1)//用成员函数来实现赋值运算符的重载。{ strcpy(name,s1.name);sno=s1.sno;strcpy(banji,s1.banji);strcpy(sex,s1.sex);age=s1.age;tel=s1.tel;for(int i=0;i
strcpy(leon[i],s1.leon[i]);return *this;} void student::inputst(char *xm ,char *xb,int nl,int xh,char *bj,long dh){
strcpy(stu[s].name,xm);strcpy(stu[s].sex,xb);stu[s].age=nl;
while(xh999)//判断输入的学号是否正确
{
cout>xh;while(checkst(xh)){
cout
cin>>xh;
}
} stu[s].sno=xh;
strcpy(stu[s].banji,bj);stu[s].tel=dh;} void student::leoninput(int s){ int n;
cout>n;for(int i=0;i
cout
cin>>stu[s].leon[i];} } void student::outputst(int s){ cout
cout>tea[u].workno;} int teacher::getworkno(int u){ return tea[u].workno;} void teacher::inputte(char *xm,char *xb,int nl,char *yb,char *kc,int gh){ strcpy(tea[u].name,xm);strcpy(tea[u].sex,xb);tea[u].age=nl;
while(gh99999)//判断输入的学号是否正确
{
cout
cin>>gh;
while(checkte(gh))
{
cout
cin>>gh;
}
} tea[u].workno=gh;
strcpy(tea[u].dep,yb);strcpy(tea[u].les,kc);} void teacher::outputte(int u){ cout
int m=0;
for(int j=0;j
{
if(strcmp(stu[i].leon[j],te.les)==0)//只有当学生学习了教师教授的课程才可以对教师进行评教
{
n++;
m++;
cout
cout
cin>>te.score;
sum+=te.score;
}
}
if(m==0)
{
cout
cout
} }
if(n==0)
{
cout
return 0;
}
else
cout
return sum/n;} int student::checkst(int xh1)//检查
{
int m=0;
while(m
break;//拒绝重复学号
if(m>s+1)
return 0;
else
return 1;}
int student::outtofile1(int s){ ofstream fout(“D:student.txt”,ios::app);if(!fout){
cout
return 1;} fout
{
int xh,p;
while(s==0)
{
cout
break;}
if(s!=0)
cout
cin>>xh;
while(xh999)
{
cout
cin>>xh;
while(checkst(xh)){
cout
cin>>xh;} } while(s!=0)//查找是否有符合条件的记录
{
if(xh==stu[s].sno)
{
p=1;
outputst(s);
cout
getch();
break;
}
else
p=0;
s--;
}
if(p==0)//用p标记是否有查找的对象。
cout
getch();} void student::resortst(int s)//按学号排序 {
student st1;
while(s==0)
{
cout
break;}
if(s!=0){
for(int i=1;i
for(int j=1;j
if(stu[j].sno>stu[j+1].sno)
{
st1=stu[j];
stu[j]=stu[j+1];
stu[j+1]=st1;
}
for(int k=1;k
{
outputst(k);
cout
} }
getch();}
void student::deletest(int n)//删除学生记录
{
int xh,p=0;
char da;
while(s==0)
{
cout
break;
}
if(s!=0)
{
cout>xh;
while(xh999){
cout>xh;
while(checkst(xh)){
cout
cin>>xh;} } for(int i=1;i
if(stu[i].sno==xh)
{
outputst(i);
cout
cout
cin>>da;
if(da=='y'||da=='Y')
{
} for(int j=i;j
{
strcpy(stu[j].name,stu[j+1].name);
strcpy(stu[j].sex,stu[j+1].sex);
stu[j].age=stu[j+1].age;
stu[j].sno=stu[j+1].sno;
strcpy(stu[j].banji,stu[j+1].banji);
stu[j].tel=stu[j+1].tel;
for(int k=0;k
strcpy(stu[j].leon[k],stu[j+1].leon[k]);}
cout
cout
p=1;}
}
if(p==0)
cout
}
getch();}
void student::coverst(int s)//为检查修改的结果应该把修改前和修改后的结果都输出来。//不允许修改学号 { int p,xh;while(s==0)
{
cout
break;}
if(s!=0){
cout>xh;while(xh999){
cout
cin>>xh;
while(checkst(xh)){
cout
cin>>xh;} } for(int i=1;i
if(stu[i].sno!=xh)
p=0;
if(stu[i].sno==xh){
p=1;
cout
outputst(i);
cout
cout
cout
cin>>stu[i].name;
cout
cin>>stu[i].sex;
}
} cout>stu[i].age;cout>stu[i].banji;cout>stu[i].tel;cout
break;if(p==0)
cout
}
getch();}
//////////////////////////// teacher teacher::operator=(teacher &t1)//用成员函数来实现赋值运算符的重载。{ strcpy(name,t1.name);workno=t1.workno;strcpy(sex,t1.sex);strcpy(dep,t1.dep);age=t1.age;score=t1.score;strcpy(les,t1.les);return *this;} int teacher::checkte(int gh1)//检查模块
{
int n=0;
while(n
break;//拒绝重复工号
if(n>u+1)
return 0;
else
return 1;} void teacher::findte(int u)//按工号查找模块 {
int gh,p;
while(u==0)
{
cout
break;}
if(u!=0){
cout>gh;
while(gh99999)//判断输入的工号是否正确
{
cout>gh;while(checkte(gh)){
cout
cin>>gh;}
} while(u!=0)//查找是否有符合条件的记录
{
if(gh==tea[u].workno)
{
p=1;
outputte(u);
cout
getch();
break;
}
else
p=0;
u--;}
if(p==0)//用p标记是否有查找的对象。
cout
teacher te;
while(u==0){
cout
break;
}
if(u!=0)
{
for(int i=1;i
for(int j=1;j
if(tea[j].workno>tea[j+1].workno)
{
te=tea[j];
tea[j]=tea[j+1];
tea[j+1]=te;
}
for(int k=1;k
{
outputte(k);
cout
} }
getch();}
int teacher::outtofile2(int u){ ofstream fout1(“D: eacher.txt”,ios::app);if(!fout1){
cout
return 1;} fout1
double teacher::resetscore(double cj,int u){ tea[u].score=cj;return tea[u].score;} void teacher::resort(int u)//按评教成绩对教师进行排序 {
teacher te;
“
} cout
cout
break;}
if(u!=0){
for(int i=1;i
{
for(int j=1;j
if(tea[j].score
{
te=tea[j];
tea[j]=tea[j+1];
tea[j+1]=te;
}
}
for(int k=1;k
{
te.outputte(k);
cout
cout
} }
getch();
void teacher::deletete(int n)//删除教师记录 {
int gh,p=0;
char da;
while(u==0)
{
cout
break;
}
if(u!=0)
{
cout
cin>>gh;
while(gh99999)//判断输入的工号是否正确
{
cout
cin>>gh;
while(checkte(gh)){
cout
cin>>gh;}
} for(int i=1;i
if(tea[i].workno==gh)
{
outputte(i);
cout
cout>da;
if(da=='y'||da=='Y'){
for(int j=i;j
{
strcpy(tea[j].name,tea[j+1].name);
strcpy(tea[j].sex,tea[j+1].sex);tea[j].age=tea[j+1].age;tea[j].workno=tea[j+1].workno;
strcpy(tea[j].dep,tea[j+1].dep);strcpy(tea[j].les,tea[j+1].les);}
cout
cout
p=1;
}
}
}
if(p==0)
cout
}
getch();}
void teacher::coverte(int u)//为检查修改的结果应该把修改前和修改后的结果都输出来。//不允许修改工号 {
int p,gh;while(u==0){
cout
break;}
if(u!=0){
cout>gh;while(gh99999)//判断输入的工号是否正确
{
cout>gh;while(checkte(gh)){
cout
cin>>gh;}
} for(int i=1;i
if(tea[i].workno!=gh)
p=0;
if(tea[i].workno==gh){
p=1;
cout
outputte(i);
cout
cout
cout
cin>>tea[i].name;
cout
cin>>tea[i].sex;
cout
cin>>tea[i].age;
cout
cin>>tea[i].dep;
cout
cin>>tea[i].les;
cout
cout
outputte(i);
cout
break;
}
}
if(p==0)
cout
}
getch();}
void main(){ student st;
char da,*xm,*xb,*bj,*yb,*kc;
int a,nl,xh,gh;long dh;teacher te;double cj;time_t t;
time(&t);
while(1)
{
system(”cls“);
cout
cout
时间和日期:”
cout
请选择操作(1-14)">a;
exit: if(a==0)break;//exit是标号。
switch(a){ case 1:
{ xm=new char[];xb=new char[];bj=new char[];cout
cout>xm;
cout>xb;cout>nl;cout>xh;cout>bj;cout>dh;while(st.checkst(xh)){
cout
cin>>xh;}
s=s+1;
st.inputst(xm,xb,nl,xh,bj,dh);st.leoninput(s);
cout>da;
while(da=='y'||da=='Y')//判断是否要继续输入
{
xm=new char[];xb=new char[];bj=new char[];cout>xm;cout>xb;cout>nl;cout>xh;
cout>bj;cout>dh;while(st.checkst(xh)){
cout
cin>>xh;}
s=s+1;
st.inputst(xm,xb,nl,xh,bj,dh);
st.leoninput(s);
cout
cin>>da;
}
getch();
};break;case 2:
{
if(s==0)//判断是否有记录输入
{
cout
getch();
break;
}
if(s!=0)
{
for(int i=1;i
{
st.outputst(i);
st.outtofile1(i);
cout
}
getch();
}
};break;
case 3:st.findst(s);break;case 4:st.resortst(s);break;case 5:st.coverst(s);break;case 6:st.deletest(s);break;case 7:
{
xm=new char[];xb=new char[];yb=new char[];kc=new char[];cout>xm;cout>xb;cout>nl;cout>gh;while(te.checkte(gh)){
cout
cin>>gh;}
cout>yb;cout>kc;
u=u+1;
te.inputte(xm,xb,nl,yb,kc,gh);
cout>da;
while(da=='y'||da=='Y')//判断是否要继续输入
{
xm=new char[];xb=new char[];yb=new char[];kc=new char[];cout>xm;cout>xb;cout>nl;cout>gh;while(te.checkte(gh)){
cout
cin>>gh;}
cout>yb;cout>kc;u=u+1;
te.inputte(xm,xb,nl,yb,kc,gh);cout
cin>>da;
}
getch();
};break;case 8: {
if(s==0)
{
cout
getch();
break;
}
if(s!=0)
{
if(u==0)//判断是否有记录输入
{
cout
getch();
break;
}
if(u!=0)
{
for(int i=1;i
{
cj=st.value(tea[i]);
te.resetscore(cj,i);
}
getch;
}
}
getch();
};break;case 9:
}
{
if(u==0)//判断是否有记录输入
{
cout
getch();
break;}
if(u!=0){
for(int i=1;i
{
te.outputte(i);
cout
te.outtofile2(i);
cout
}
getch();
}
};break;case 10:te.findte(u);break;case 11:te.resort(u);break;case 12:te.resortte(u);break;case 13:te.coverte(u);break;case 14:te.deletete(u);break;default:
{
while(a==0||a>14)//判断选项是否正确
{
cout
cin>>a;
}
goto exit;
};
break;
} }
cout