一个小型学生成绩管理程序

类别:编程语言 点击:0 评论:0 推荐:

//小型学生成绩管理程序

#include

#include

 

// Declaration and definition of class base_Student

class base_Student

{

public:

       base_Student();                                                  //constructor

       base_Student(base_Student&);                              //copy constructor

       char* operator =(char Name1[])                                   //overload operator =

       {

              return Name1;

       }

       void Initial(void);

       float ShowScore(void);

       void Show(void);

private:

       int ID;

       char Name[20];

       float Score;

};

 

//constructor

base_Student::base_Student()                                     

{

       ID=0;

       Score=0;

}

 

//copy constructor

base_Student::base_Student(base_Student& Student1)      

{    

       Student1.ID=ID;

       strcpy(Student1.Name,Name);

       Student1.Score=Score;

}

 

//initialize student's data

void base_Student::Initial(void)                             

{

       cout<<"ID:";

       cin>>ID;

       cout<<"Name:";

       cin>>Name;

       cout<<"Score:";

       cin>>Score;

}

 

//return student's score

float base_Student::ShowScore(void)                                  

{

       return Score;

}

 

//display student's information

void base_Student::Show(void)                                   

{

       cout<

本文地址:http://com.8s8s.com/it/it28579.htm