?? chemistry.cpp
字號:
#include<iostream.h>
#include"chemistry.h"
#include"string.h"
chemistry::chemistry(char *n,int Eng,int Chi,int Mat,int Yjhx,int Hxfx)
{
strcpy(name,n);
English=Eng;
Chinese=Chi;
Math=Mat;
yjhx=Yjhx;
hxfx=Hxfx;
}
char* chemistry::getName()
{
return name;
}
int chemistry::getEng()
{
return English;
}
int chemistry::getChi()
{
return Chinese;
}
int chemistry::getMat()
{
return Math;
}
void chemistry::setEng(int x)
{
English=x;
}
void chemistry::setChi(int x)
{
Chinese=x;
}
void chemistry::setMat(int x)
{
Math=x;
}
int chemistry::getTotal()
{
Total=Math+Chinese+English;
return Total;
}
float chemistry::getAverage()
{
average=Total/3;
return average;
}
int chemistry::getMajtotal()
{
majTotal=yjhx+hxfx;
return majTotal;
}
float chemistry::getMajave()
{
majAve=majTotal/2;
return majAve;
}
int chemistry::getyjhx()
{
return yjhx;
}
int chemistry::gethxfx()
{
return hxfx;
}
void chemistry::setyjhx(int x)//設置有機化學成績
{
yjhx=x;
}
void chemistry::sethxfx(int x) //設置化學分析成績
{
hxfx=x;
}
void chemistry::show()
{
cout<<"學生姓名:"<<name<<endl;
cout<<"各公共課成績:"<<English<<" "<<Chinese<<" "<<Math<<endl;
cout<<"平均分和總分:"<<average<<" "<<Total<<endl;
cout<<"有機化學成績:"<<yjhx<<" "<<"化學分析成績:"<<hxfx<<endl;
cout<<"專業課平均分:"<<majAve<<" "<<"專業課總分:"<<majTotal<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -