注册 登录
编程论坛 C++教室

编写一个程序,已有若干个学生的数据,包括学号、姓名、成绩,要求输出这些学生的数据并计算出学生人数和平均成绩(要求将学生人数和总成绩用静态数据成员表示)。

qq68677589 发布于 2020-03-29 12:45, 3712 次点击
编写一个程序,已有若干个学生的数据,包括学号、姓名、成绩,要求输出这些学生的数据并计算出学生人数和平均成绩(要求将学生人数和总成绩用静态数据成员表示)。
#include<iostream>
#include<string>
using namespace std;
class Student{
public:
    Student(string name1, string stu_no1,float score1);
    static void show(Student& stu);
    static void show_count_sum_avg();
    ~Student();
private:
    string name;
    string stu_no;
    float score;
    static float sum;
    static int count;
};
float Student::sum = 0.0;
int Student::count = 0;
提示有错误,大佬们解决一下可好啊?
2 回复
#2
lin51616782020-03-30 12:04
错误提示呢
#3
qq686775892020-03-30 12:07
回复 楼主 qq68677589
版主您好,这段代码能继续写下去吗?或其他也可以。
1