设计一个学生类,包含学号、姓名、课程、成绩,计算学生们的各科平均成绩,学生人数依输入而定

#include
#include
using namespace std;
const int N=3;

class Student
{
private:
	char No[9];
	char Name[10];
	double G1,G2,G3;
	static double sum1,sum2,sum3;
	static int num;
public:
	Student(char no[ ],char name[ ],double g1,double g2,double g3)
	{
		num++;
		strcpy(No,no);
		strcpy(Name,name);
		G1=g1;
		G2=g2;
		G3=g3;
		sum1+=g1;
		sum2+=g2;
		sum3+=g3;
	}
	double ave1( )
	{
		return sum1/num;
	}
	double ave2( )
	{
		return sum2/num;
	}
	double ave3( )
	{
		return sum3/num;
	}
	void ShowScore()
	{
		cout<< No<<"\t"<


你可能感兴趣的:(c++)