#include <iostream>
#include <vector>
class Student {
private:
float score;
static float total;
static int count;
public:
Student(float score) {
this->score = score;
total += score;
count++;
}
void scoretotalcount(float score) {
this->score = score;
total += score;
count++;
}
float getScore() const {
return score;
}
static float sum() {
return total;
}
static float average() {
return total / count;
}
};
float Student::total = 0;
int Student::count = 0;
int main() {
std::vector<Student> students;
students.push_back(Student(90));
students.push_back(Student(85));
students.push_back(Student(88));
for (auto& student : students) {
std::cout << "分数: " << student.getScore() << std::endl;
}
std::cout << "总分: " << Student::sum() << std::endl;
std::cout << "平均分: " << Student::average() << std::endl;
return 0;
}