- 9
- 0
- 约5.74千字
- 约 11页
- 2018-01-02 发布于河南
- 举报
最终版CPP
最终版CPP
#includeiostream
#includestring
#include fstream
#includeiomanip
using namespace std;
class node
{
public:
node* left;
node* right;
node()
{
left=0,right=0;
}
void add(node* n)
{
n-right=right;
n-left=this;
if(right!=NULL)right-left=n;
right=n;
}
node* del1()
{
if(left!=0)left-right=right;
if(right!=0)right-left=left;
return 0;
}
void show()
{
cout姓名: setw(8)NAMEendl;
cout班级: setw(8)GRADEendl;
cout性别: setw(8)SEXendl;
cout院系: setw(8)YARDendl;
cout成绩如下: endl;
coutC++ : setw(8)CPPendl;
cout英语: setw(8)ENGLISHendl;
cout数学: setw(8)MATHendl;
coutendl;
}
string NAME;
string GRADE;
string SEX;
string YARD;
string CPP;
string ENGLISH;
string MATH;
};
node* delete1(node head, string name)
{
for(node*i=head.right; i!=0; i=i-right)
{
if(i-NAME==name)
{
return i;
}
}
return 0;
}
void init(node head,string name,string grade,string sex,string yard,string cpp,string english,string math)
{
node* n;
n=new node;
n-NAME = name;
n-GRADE = grade;
n-SEX = sex;
n-YARD = yard;
n-CPP = cpp;
n-ENGLISH = english;
n-MATH = math;
head.add(n);
}
void del(node* n)
{
if(n!=0)n-del1();
delete n;
}
void enter(node head)
{
//system(cls);
node* n;
n=new node;
cout输入姓名、班级、性别、院系、成绩:endl;
cout姓名: ;
cinn-NAME;
cout班级: ;
cinn-GRADE;
cout性别: ;
cinn-SEX;
cout院系: ;
cinn-YARD;
cout成绩:endl;
coutCPP : ;
cinn-CPP;
cout英语: ;
cinn-ENGLISH;
cout数学: ;
cinn-MATH;
cout___________________输入完成__endl;
head.add(n);
}
void display(node head)
{
for(node*i=head.right; i!=0; i=i-right)
{
i-show();
}
}
void search(node head, string name)
{
for(node*i=head.right; i!=0; i=i-right)
{
if(i-NAME==name)
{
if(i!=0)
{
i-show();
}
原创力文档

文档评论(0)