studentrecord.cc

来自「C++ class and storage」· CC 代码 · 共 45 行

CC
45
字号
//studentRecord.cc#include <iostream>#include <string>#include "studentRec.h"using namespace std;studentRecord::studentRecord(){studentNumber=0; *_firstName="FNU"; *_lastName="LNU"; for(int i=0;i<NUM_OF_MARKS;i++)  {marks[i]=0;}}	studentRecord::~studentRecord()	{}	void studentRecord::setStudentNumber(unsigned int studentNum){studentNumber=studentNum;}	void studentRecord::setFirstName(char* firstName){_firstName=firstName;}	void studentRecord::setLastName(char* lastName){_lastName=lastName;}	void studentRecord::setMark(int index, unsigned int mark){marks[index]=mark;}	unsigned int studentRecord::*getStudentNumber() const{return(studentNumber);}	string studentRecord::*getFirstName() const{return(_firstName);}	string studentRecord::*getLastName() const{return(_lastName);}	unsigned int studentRecord::getMark(int index) const{return(marks[index]);}void studentRecord::print() const{cout<<"Student number: "<<studentNumber<<endl; cout<<"Student name: "<<*_lastName<<", "<<*_firstName<<endl; cout<<"Student marks: "<<marks[0]<<", "<<marks[1]<<", "<<marks[2]<<", "<<marks[3]<<", "<<marks[4]<<endl;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?