#include
using namespace std;
class score {
public:
double score_[3];
void print_avg() {
double sum = 0.0;
for ( int i=0; i<3; i++ ) { sum += score_[i]; }
cout << sum/3.0 << '\n';
}
};
class teacher: public score {
public:
teacher( const double* score ) {
for ( int i=0; i<3; i++ ) { score_[i] = *(score+i); }
}
};
class student: public score {
public:
student( const double* score ) {
for ( int i=0; i<3; i++ ) { score_[i] = *(score+i); }
}
};
int main(int argc, char *argv[]) {
// change ary[] to be a manual value input if you wanna generate the average score in the running time
double ary[] = { 9.1, 7.8, 6.1 };
student std1( &ary[0] );
std1.print_avg();
teacher teh1( &ary[0] );
teh1.print_avg();
}