1、程序基本功能
1)该系统主要处理课外兴趣小组的相关信息。
2)学生信息主要包括:学号、姓名、性别、兴趣爱好等内容。
3)兴趣主要包括:兴趣编号、兴趣类型等内容。
4)完成以下的操作:实现学生兴趣信息的添加、修改、删除和查询。
2、程序设计方案和原理
1)建立学生类、兴趣类、兴趣类型类
2)学生、兴趣、兴趣类型信息的初始化
3)学生、兴趣、兴趣类型信息的添加、修改、删除、查找
4)学生兴趣信息的输出
5)将学生兴趣信息保存为文件
3、思维导图
4、程序的代码实现
#include<iostream.h>
#include<string.h>
#include<iomanip.h>
#include<fstream.h>
//学生类
class Student
{
public:
Student(int stu_no1=-1,char* name1=" ",char* sex1=" ");
~Student();
int stu_no;
char* name;
char* sex;
};
Student::Student(int stu_no1,char* name1,char* sex1)
{
stu_no=stu_no1;
name=new char[strlen(name1)+1];
strcpy(name,name1);
sex=new char[strlen(sex1)+1];
strcpy(sex,sex1);
}
Student::~Student()
{
delete []name;
delete []sex;
}
//兴趣类
class Intrest:public Student
{
public:
Intrest(int stu_no1,char* name1,char* sex1,int num1=-1,char* style1=" ");
~Intrest();
int num;
char* style;
};
Intrest::Intrest(int stu_no1,char* name1,char* sex1,int num1,char* style1):Student(stu_no1,name1,sex1)
{
num=num1;
style=new char[strlen(style1)+1];
strcpy(style,style1);
}
Intrest::~Intrest()
{
delete []style;
}
//兴趣类型类
class Kind:public Intrest
{
public:
Kind(int stu_no1=-1,char* name1=" ", char* sex1=