示例#1
0
int main()
{
    string firstName;
    string lastName;
    int id;
    int num_scores;
    
    cin >> firstName;
    cin >> lastName;
    cin >> id;
    cin >> num_scores;

    vector<int> scores(num_scores);
    for (int i = 0; i < num_scores; ++i) {
        cin >> scores[i];
    }

    Student *s = new Student(firstName, lastName, id, scores);
    s->printPerson();
    cout << "Grade: " << s->calculate() << endl;

    return 0;



}
示例#2
0
int main_inheritance() {
	string firstName;
	string lastName;
	int id;
	int numScores;
	cin >> firstName >> lastName >> id >> numScores;
	vector<int> scores;
	for (int i = 0; i < numScores; i++) {
		int tmpScore;
		cin >> tmpScore;
		scores.push_back(tmpScore);
	}
	Student* s = new Student(firstName, lastName, id, scores);
	s->printPerson();
	cout << "Grade: " << s->calculate() << "\n";
	return 0;
}