#include <iostream>
#include <string>
using namespace std;
struct Student {
string name;
int score;
};
void averagetotal(Student s[], int size) {
int total = 0;
for (int i = 0; i < size; i++) {
total += s[i].score;
}
double avg = total / (double)size;
cout << "총합: " << total << endl;
cout << "평균: " << avg << endl;
}
int main() {
Student stu[5];
for (int i = 0; i < 5; i++) {
cin >> stu[i].name >> stu[i].score;
}
averagetotal(stu, 5);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: