Jial008 2015-05-01 08:41 采纳率: 0%
浏览 1676

C++程序编写一个学生管理系统出了一个问题,求大家帮忙看一下是哪出了问题

#include
#include
using namespace std;
class Student()
{
int no;
string name;
float score;
Student *per;
Student *next;
public:
Student();
Student *find(int i_no);
void edit(string i_newname,float i_score);
void erase();
int add(Student *i_nemStudent);
int getno();
string getname();
float getscore();
static int maxno;
};
Student::Student()
{
score=0.0;
per=NULL;
next=NULL;
}
Student *Student::find(int i_no);
{
if(i_no==no)
return this;
if(i_no!=NULL)
return next->find(i_no);
return NULL;
}
void Student::edit(string i_name,float i_score)
{
if(i_name==" ")
return;
name=i_name;
score=i_score;
}
void Student::erase()
{
if(no return;
if(per!=NULL)
per->next=next;
if(next!=NULL)
next->per=per;
next=NULL;
per=NULL;
}
int Student::add(Student *i_newStudent)
{
int no=maxno+1;
while(ture)
{
if(NULL==find(no))
break;
no=no+1;
}
Student *tmp=this;
while (ture)
{
if(tmp->next==NULL)
break;
tmp=tmp->next;
}
tmp->next=i_newStudent;
i_newStudent->next=NULL;
i_newStudent->per=tmp;
i_newStudent->no=no;
return no;
}
int Student::getno()
{
trturn no;
}
string Student::getname()
{
return name;
}
float Student::getscore()
{
return score;
}
int Student::maxno=1000;
int main()
{
Student *studentroot=new Student();
string=input1;
float=input2;
Student *tmp=NULL;
while (ture)
{
cout<<"输出指令:查找(F),增加(A),编辑(E),删除(D),退出(Q)"< cin>>input1;
if (("F"==input1)||("f==input1"))
{
cout<<"输入学号:";
int id=-1;
cin>>id;
tmp=studentroot->find(id);
if(tmp==NULL)
{
cout<<"没找到"< continue;
}
coutgteno();
cout<<"姓名:";
string name;
if ((name=tmp->getname())!="")
cout< else
cout coutgetscore()< }
else if ((input1=="A")||(input1=="a"))
{
cout cin>>input1>>input2;
tmp=new Student();
tmp->edit(input1,input2);
cout<<"学号:"<add(tmp)< }
else if((input1=="E")||(input1=="e"))
{
cout int id=0;
cin>>id;
tmp=studentroot->find(id);
if(tmp==NULL)
{
cout<<"空号"< continue;
}
cout cin>>input1>>input2;
tmp->edit(input1,input2);
cout<<"更改成功."< }
else if((input1=="D")||(input2=="d"))
{
cout int id=0;
cin>>id;
tmp=studentroot->find(id)
tmp->erase();
cout<<"已成功删除"<<endl;
delete tmp;
}
else if((inpue1=="Q")||(input1=="q"))
{
break;
}
else
{
cout<<"输入有误!"<<endl;
}
}
delete studentroot;
return 0;
}

  • 写回答

3条回答 默认 最新

  • 纵横车 2015-05-01 10:34
    关注

    首先class Student后面为什么有“()”?

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算