예제 #1
0
파일: twelve.cpp 프로젝트: walrus7521/code
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;
}