题目:
定义一个学生类CStudent实现简单的学籍管理功能,要求该类至少实现以下功能:
(1) 录入学生的基本信息(包括姓名,学号,性别,年龄,专业,入学时间,各门功课成`绩)
(2) 定义Date类来定义学生入学时间
(3) 定义Subject类表示学生三门功课成绩:数学,英语和C语言。统计学生每门功课总成绩和平均成绩。
(4) main()函数中初始化5个学生基本信息
(5) 输出学生的基本信息
(6) 输出每门功课总成绩
(7) 输出每门功课平均成绩
解答:
#include<iostream>
using namespace std;
class Date {
public:
int year;
int month;
int day;
};
class Subject {
public:
double math;
double english;
double CProgram;
};
class CStudent{
private:
string name;
int studentID;
string sex;
int age;
string major;
Date enrollmentTime;
Subject score;
double scoreTotal;
double scoreAverage;
public:
static double number;
static double mathTotal;
static double englishTotal;
static double CProgramTotal;
CStudent(string n,
int I,
string s,
int a,
string m,
int ye