#include <iostream>
#include <algorithm>
#define MAX 1000
using namespace std;
class average{
float n; //과목갯수
float score[MAX]; //과목
float M; //최고값
float res; // 결과값
public:
average();
void cal();
void output();
};
average::average(){
M = 0.0;
res = 0.0;
}
void average::cal(){
cin >> n;
for(int i=0; i<n; i++){
cin >> score[i];
if(score[i] > M) M = score[i];
res += score[i];
}
res = (res/M * 100.0) / n;
}
void average::output(){
cout << res;
}
int main(){
average student;
student.cal();
student.output();
return 0;
}
너무 C만 쓰다보니까 최대한 C++ 스럽게 (?) 작성하려고 노력중이네요..