#include <iostream>
#include <string>
using namespace std;
struct Person {
string name;
int age;
};
struct Student : public Person {
int score[3];
double average;
void calcAverage() {
int sum = 0;
for (int i = 0; i < 3; i++) {
sum += score[i];
}
average = sum / 3.0;
}
};
int main() {
Student s;
cin >> s.name;
cin >> s.age;
for (int i = 0; i < 3; i++) {
cin >> s.score[i];
}
s.calcAverage();
cout << "평균: " << s.average << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: