大学生c++运行过程报错:无法解析的外部符号

c++运行过程报错:无法解析的外部符号

#include <iostream>
using namespace std;
class Student {
public:
    static float sum();
    static float average();
    void scoretotalcount(float s);
private:
    static float total;
    static int count;
    float score;
};

void Student::scoretotalcount(float s) {
    score = s;
    count++;
    total = total + s;
}
float Student::sum()
{
    return total;
}
float Student::average()
{
    return total / count;
}
int Student::count = 0;

int main()
{
    Student stu[80] = {};
    int n;
    float s;
    int i;
    printf("请输入学生个数");
    scanf_s("%d", &n);
    printf("请输入学生成绩");
    for (i = 0; i < n; i++)
    {
        scanf_s("%f", &s);
        stu[i].scoretotalcount(s);
    }
    cout << "班级总分为:";
    cout << Student::sum() << endl;
    cout << "班级平均分为:";
    cout << Student::average() << endl;
    system("pause");
    return 0;
}


![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/856850068286188.png "#left")
请问这样报错要如何改呢
#include <cstdio>
using namespace std;

class Student {
public:
    static float sum();
    static float average();
    void scoretotalcount(float s);
private:
    static float total;
    static int count;
    float score;
};

void Student::scoretotalcount(float s) {
    score = s;
    count++;
    total += s;
}

float Student::sum() {
    return total;
}

float Student::average() {
    if (count == 0) {
        return 0;
    }
    return total / count;
}

int Student::count = 0;
float Student::total = 0;

int main() {
    Student stu[80] = {};
    int n;
    float s;
    printf("请输入学生个数:");
    scanf_s("%d", &n);
    printf("请输入每个学生的成绩:");
    for (int i = 0; i < n; i++) {
        scanf_s("%f", &s);
        stu[i].scoretotalcount(s);
    }
    printf("班级总分为:%.2f\n", Student::sum());
    printf("班级平均分为:%.2f\n", Student::average());
    return 0;
}