📄 student.cpp
字号:
// student.cpp
#include "student.h"
using std::endl;
int student::total=0;
student::student()
{
strcpy(name,"no name");
sex = 'f';
clas = 0;
number = "000000";
score = 10.0;
}
student::student(const char * nam,char se,int cla,string num,float sco)
{
strcpy(name,nam);
sex = se;
clas = cla;
number = num;
score = sco;
}
student::~student()
{
}
student::student(student &stud)
{
strcpy(name,stud.name);
sex=stud.sex;
clas=stud.clas;
number=stud.number;
score=stud.score;
total=stud.total;
}
void student::operator = (const student &stud)
{
strcpy(name,stud.name);
sex =stud.sex;
clas =stud.clas;
number = stud.number;
score = stud.score;
total = stud.total;
}
bool student::operator == (const student &stud)
{
if((!strcmp(name,stud.name))&&(sex==stud.sex)&&(clas==stud.clas)&&(number==stud.number)&&(score==stud.score))
return true;
else
return false;
}
void student::reducetotal()
{
total--;
}
void student::addtotal()
{
total++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -