📄 student.h
字号:
# pragma once
#ifndef _STUDENT_H_
#define _STUDENT_H_
#include <iostream>
#include <iomanip>
#include<list>
#include "person.h"
#include "course.h"
using namespace std;
enum COMPARE
{
BY_ID,
BY_NAME,
BY_AVG_SCORE,
BY_SUM_SCORE,
BY_SEX,
};
class Student:public Person
{
public:
int crsNum;
Student( const char *,const int =-1,const Sex =MALE,const COMPARE = BY_ID);
Student( const string="" ,const int =-1,const Sex =MALE,const COMPARE = BY_ID);
Student( const Person& );
Student( const Student &);
~Student();
Student & operator = ( const Student &);
bool operator == (const Student &) const;
bool operator>(const Student &)const;
bool operator<(const Student &)const;
bool operator>=(const Student &)const;
bool operator<=(const Student &)const;
void addCourse(Course &);
bool deleteCourse(Course &);
void write(ostream &);
void read( istream &);
float getAverageScore()const;
float getSumScore()const;
void setFlag(const COMPARE);
void printBase();
void printDetail();
void printCourses(int id)
{
list<Course>::iterator iBegin = courses.begin();
list<Course>::iterator iEnd = courses.end();
while(iBegin!= iEnd)
{
cout<<"Cname="<<(*iBegin).getId()<<",Cid="<<(*iBegin).getId()<<",Cscore= "<<(*iBegin).getScore()<< endl;
iBegin++;
}
}
#ifdef _DEBUG_
void printCourses()
{
list<Course>::iterator iBegin = courses.begin();
list<Course>::iterator iEnd = courses.end();
while(iBegin!= iEnd)
{
(*iBegin).printCourse();
iBegin++;
}
}
void printStudent()
{
cout<<"Sname= "<<name<<", Sid= "<<id<<", Sex="<<sex<<",crsNum= "<<crsNum<<endl;
printCourses();
}
#endif
public:
list<Course> courses;
COMPARE flag;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -