求助
c++吧
全部回复
仅看楼主
level 1
飞翔颯 楼主
include<iostream.h>
class Student
{
int number;
char *name;
float eg,mg,cg;
public:
int sum1()
{
int ave;
ave=(eg+mg+cg)/3;
}
void printf1()
{
cout<<"name"<<name<<" "<<"ave"<<ave<<endl;
}
void get_reg_num(char *a,float b,float c,float d,int e)
{
eg=b;
cg=c;
mg=d;
number=e;
name=a;
}
static Student *lead;
Stueden *next;
};Student * Student::lead=NULL;void main()
{
Student *a,*b,*c,*m;
char d,*e;
float f,g,h;
int l;
cout<<"请选择功能"<<endl;
cout<<"1添加"<<" 2查询"<<" 3结束"<<endl;
do
{
cin>>d;
if(d=='3')
break;
else
{
switch(d)
case'1':
{
cout<<"请输入名字,学号,英语计算机数学成绩"<<endl;
cin>>e>>l>>f>>g>>h;
if(a->lead==NULL)
{
a->get_reg_num(e,f,g,h,l);
a->lead=a;
}
else
{
a->next=new Student;
b=a->next;
b->get_reg_num(e,f,g,h,l);
c=a->lead;
m=b;
a->lead=b;
a->next=c;
}
}
}
}while(1);
}
想用类做个学生资料的链表 先做了输入资料的部分但是那个NEXT老是出错。。。。
麻烦大家看一下 谢谢了

2012年03月06日 14点03分 1
1