📄 student.cpp
字号:
#include <iostream>
#include "student.h"
using namespace std;
CStudent::CStudent()
{
strName = "General Student";
chinese = 0 ;
math = 0 ;
english = 0 ;
}
CStudent::CStudent(std::string Name, double c, double m, double e)
{
strName = Name ;
chinese = c ;
math = m ;
english = e ;
}
CStudent CStudent::operator +(CStudent S)
{
CStudent temp ;
temp.strName = "Total Preformance";
temp.chinese = this->chinese + S.chinese;
temp.math = this->math + S.math ;
temp.english = this->english + S.english;
return temp;
}
ostream& operator <<(ostream& out , CStudent S)
{
out<<S.strName<<"( "<<S.chinese<<" , "<<S.math<<" , "<<S.english<<" )"<<endl;
return out;
}
void CStudent::SetChinese(double a)
{
chinese = a;
}
void CStudent::SetEnglish(double a)
{
english = a;
}
void CStudent::SetMath(double a)
{
math = a;
}
double CStudent::returnChinese()
{
return chinese ;
}
double CStudent::returnEnglish()
{
return english ;
}
double CStudent::returnMath()
{
return math ;
}
double CStudent::returnTotalPreformance()
{
return chinese + math + english ;
}
double CStudent::returnAverage()
{
return (chinese + math + english)/3;
}
string CStudent::returnName()
{
return strName;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -