📄 clsscoresheet.h
字号:
#ifndef CLASS_SCORE_SHEET
#define CLASS_SCORE_SHEET
const int NOT_CHOOSE_THIS_COURSE = -2;
const int NOT_EXAMINED = -1;
const int ERROR_RETURN_VALUE = -10;
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
struct scoretype
{
int score;
int point;
char scorestr[7];
char pointstr[6];
};
struct student
{
char* num;
char* name;
scoretype* score;
};
struct course
{
char* name;
int coefficient;
};
class ScoreSheet
{
public:
ScoreSheet();
~ScoreSheet();
int GetColumnWidth(int index, bool sorted=false);
int AddStudent ();
void DelStudent (int index, bool sorted=false);
int GetStudentCount() { return scnt; }
int* StudentSort () { return ss; }
void SetStuNum (int index, const char* newNum, bool sorted=false);
void SetStuName (int index, const char* newName, bool sorted=false);
void SetScoreInt (int StudentIndex, int CourseIndex, int Score, bool StudentSorted=false, bool CourseSorted=false, bool Recalculate=true);
void SetScore (int StudentIndex, int CourseIndex, double Score, bool StudentSorted=false, bool CourseSorted=false) { SetScoreInt(StudentIndex,CourseIndex,int(Score*100.0+0.5),StudentSorted,CourseSorted); }
void Calculate (int StudentIndex, bool Sorted=false);
student* Stu (int index, bool sorted=false);
char* GetStuNum (int index, bool sorted=false);
char* GetStuName (int index, bool sorted=false);
int GetScoreInt (int StudentIndex, int CourseIndex, bool StudentSorted=false, bool CourseSorted=false);
char* GetScoreStr (int StudentIndex, int CourseIndex, bool StudentSorted=false, bool CourseSorted=false);
double GetScore (int StudentIndex, int CourseIndex, bool StudentSorted=false, bool CourseSorted=false) { return GetScoreInt(StudentIndex,CourseIndex,StudentSorted,CourseSorted)/100.0; }
int GetPointInt (int StudentIndex, int CourseIndex, bool StudentSorted=false, bool CourseSorted=false);
char* GetPointStr (int StudentIndex, int CourseIndex, bool StudentSorted=false, bool CourseSorted=false);
double GetPoint (int StudentIndex, int CourseIndex, bool StudentSorted=false, bool CourseSorted=false) { return GetPointInt(StudentIndex,CourseIndex,StudentSorted,CourseSorted)/10.0; }
int AddCourse (const char* name=NULL, int coefficient=1);
void DelCourse (int index, bool sorted=false);
int GetCourseCount() { return ccnt; }
int* CourseSort() {return sc; }
void SetCourseName (int index, const char* newName, bool sorted=false);
void SetCourseCoefficient(int index, int newCoefficient, bool sorted=false);
course* Cour (int index, bool sorted=false);
char* GetCourseName (int index, bool sorted=false);
double GetCourseCoefficient(int index, bool sorted=false);
private:
ScoreSheet(ScoreSheet& copy);
student **s;
int scnt, smax, *ss;
course *c;
int ccnt, cmax, *sc, numwidth, namewidth;
inline bool isbetween(int judge, int lower, int upper);
inline int fixmultiple(int origin, int multiple);
bool stuavailable(int id, bool sorted, int& idOriginal);
bool couravailable(int id, bool sorted, int& idOriginal);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -