#include
#include
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
jige++;
}
void student::show()
{
cout<<"姓名:\t"<
void student::show_info()
{
cout<<"共有学生"<
cout<<"平均成绩是"<
void main()
{
student* obj;
int n;
cout<<"请输入学生总数:";
cin>>n;
if (n<=0)
{
cout<<"错误的学生人数"<
}
obj = new student[n];
for (int i=0;i
cout<<"请输入第"<obj[i].getinfo();
}
while(i--)
obj[i].show();
student::show_info();
delete[] obj;
}
恩~8错~
恩!~~~确实!!!!