用c++怎么写一个输出一个班的学习成绩的程序???求救!!

来源:百度知道 编辑:UC知道 时间:2024/05/28 04:24:08

#include<iostream>
#include<cstring>
using namespace std;

class student
{
static int n;//学生人数
static float sum;//总成绩
static int jige;//及格人数
static int bujige;//不及格人数

char name[32];
char num[32];
int score;
public:
student(){};
~student();
void getinfo();
void show();
static void show_info();
};

int student::n = 0;
float student::sum = 0;
int student::jige = 0;
int student::bujige = 0;

student::~student()
{
n--;
sum-=score;
if (score<60)
bujige--;
else
jige--;
}
void student::getinfo()
{
cout<<"请输入姓名:";
cin>>name;
cout<<"请输入学号:";
cin>>num;
cout<<"请输入成绩:";
cin>>score;

sum+=score;
n++;
if (score<60)
bujige++;
else