你又不给好处谁帮你做啊,悬赏分又不能吃=_=
这个一般大家没有那么多时间帮忙整的
年轻人还是自己动手吧
这样多学点
给我汇款100元,我还可以考虑考虑
策箭酗pogfzywdxh
我给你!!!!
记得加分!!!!!
#include
#include
#include
#include
//学生类
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=" ",int num1=-1,char* style1=" "):Intrest(stu_no1,name1,sex1,num1,style1)
{}
void insert();
void modify();
void del();
void show();
void setstu(int stu_no1)
{
stu_no=stu_no1;
}
void setname(char* name1)
{
name=new char[strlen(name1)+1];
strcpy(name,name1);
}
void setsex(char* sex1)
{
sex=new char[strlen(sex1)+1];
strcpy(sex,sex1);
}
void setnum(int num1)
{
num=num1;
}
void setstyle(char* style1)
{
style=new char[strlen(style1)+1];
strcpy(style,style1);
}
static int count;
}stu[100];
int Kind::count=0;
void Kind::insert()
{
cout<<"学生学号:"<
cout<<"学生姓名:"<
cout<<"学生性别:"<
cout<<"兴趣编号:"<
cout<<"兴趣类型:"<
count++;
}
void Kind::modify()
{
cout<<"+++++请选择要进行的修改:"<
cin>>a;
switch(a)
{
case 1:
cout<<"输入新的学号:"<
break;
case 2:
cout<<"输入新的姓名:"<
break;
case 3:
cout<<"输入新的性别:"<
break;
case 4:
cout<<"输入新的编号:"<
break;
case 5:
cout<<"输入新的类型:"<
break;
default:
return;
}
}
void Kind::del()
{
stu_no=-1;
name=" ";
sex=" ";
num=-1;
style=" ";
count--;
}
void search()
{
cout<<"输入要查询的学生的学号:"<
cin>>r;
for(int i=0;i
if(stu[i].stu_no==r)
{
cout<
o=0;
}
}
if(o==1)
cout<<"没有该学号,查询失败"<
void Kind::show()
{
cout<
void pri()
{
ofstream fout("学生兴趣小组管理.txt");
if(!fout)
{
cout<<"can not open output file"<
}
fout<
fout<
fout.close();
cout<<"保存成功!"<
}
void menu()
{
cout<<"===========学生兴趣小组管理============"<
void main()
{
for(;;)
{
menu();
cout<<"请选择您要进行的处理:"<
cin>>i;
switch(i)
{
case 1:
cout<<"请输入要添加的学生的人数:"<
cin>>n;
for(i=0;i
stu[Kind::count].insert();
}
if(n==0)
cout<<"无输入!!!"<
cout<<"输入完毕!!!"<
case 2:
cout<<"输入要修改的学生的学号:"<
cin>>p;
for(i=0;i
if(stu[i].stu_no==p)
{
stu[i].modify();
cout<<"修改成功!!!"<
}
break;
case 3:
cout<<"输入要删除的学生的学号:"<
cin>>q;
for(i=0;i
if(stu[i].stu_no==q)
{
stu[i].del();
}
}
for(;i
Kind temp;
temp=stu[i];
stu[i]=stu[i+1];
stu[i+1]=stu[i];
}
break;
case 4:
search();
break;
case 5:
cout<
break;
case 6:
pri();
break;
default:
return;
}
}
}