cout<<"\n按任意键继续..";
getch();
}
voidHelp()
{
system("cls");
cout<<"帮助:
\n\n\t该系统是C++学生成绩管理系统,输入一些学生信息及考试成绩,";
cout<<"可以相应的显示出学生的信息,各科成绩,总成绩,平均成绩,学分积点等。
";
cout<<"通过输入、排序、删除等功能,可以任意的对学生的信息加以变动。
";
cout<<"在主页面输入对应的数字,可以对不同的选项进行操作。
";
cout<<"\n\n\n\n";
cout<<"关于:
\n\n\t系统名称:
学生成绩管理系统\n\n\t制作人:
袁永国1240407128";
cout<<"\n\n\n";
cout<<"按任意键继续..";
getch();
}
private:
Student*Head,*End;
ifstreamin;
ofstreamout;
Student*FindItem(char*name)
{
for(Student*p=Head;p->Next!
=End;p=p->Next)
if(!
strcmp(p->Next->name,name))returnp;
returnNULL;
}
Student*FindID(char*Id)
{
for(Student*p=Head;p->Next!
=End;p=p->Next)
if(!
strcmp(p->Next->Id,Id))returnp;
returnNULL;
}
Student*FindSex(char*sex)
{
for(Student*p=Head;p->Next!
=End;p=p->Next)
if(!
strcmp(p->Next->sex,sex))returnp;
returnNULL;
}
Student*FindOrigin(char*origin)
{
for(Student*p=Head;p->Next!
=End;p=p->Next)
if(!
strcmp(p->Next->origin,origin))returnp;
returnNULL;
}
};
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌构造函数﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
Studentmassage:
:
Studentmassage()
{
Head=newStudent;
Head->Next=newStudent;
End=Head->Next;
in.open("sort.txt");
if(!
in)
cout<<"这是一个新系统,无学生信息。
请先输入。
"<else
{
while(!
in.eof())
{
End->ReadFile(in);
if(End->name[0]=='\0')break;
End->Next=newStudent;
End=End->Next;
}
in.close();
cout<<"\t\t读取学生信息成功!
"<}
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌析构函数﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
Studentmassage:
:
~Studentmassage()
{
Save();
for(Student*temp;Head->Next!
=End;)
{
temp=Head->Next;
Head->Next=Head->Next->Next;
deletetemp;
}
deleteHead,End;
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌菜单﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
voidStudentmassage:
:
ShowMenu()
{
cout<<"------------------<<学生成绩管理系统>>------------------"<cout<<"****************************************************************************"<cout<<"$1.增加学生成绩$"<cout<<"$2.显示学生成绩$"<cout<<"$3.排序统计成绩$"<cout<<"$4.查找学生成绩$"<cout<<"$5.删除学生成绩$"<cout<<"$6.修改学生信息$"<cout<<"$7.获奖学金学生$"<cout<<"$8.查看三好学生$"<cout<<"$9.帮助与关于$"<cout<<"$0.安全退出系统$"<cout<<"****************************************************************************"<cout<<"\n\t\t\n\t\t请选择:
";
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌查找函数﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
voidStudentmassage:
:
Find()
{
system("cls");
charname[20],Id[10];
intx;
Student*p=NULL;
cout<<"\n\t\t*********************************\n";
cout<<"\t\t※1.按学生的姓名查找\n\t\t※2.按学生学号查找";
cout<<"\n\t\t*********************************\n请选择:
";
cin>>x;
switch(x)
{
case1:
{
cout<<"请输入要查找的学生的姓名:
";cin>>name;
if(p=FindItem(name))
{
p->Next->Show();
cout<<"\n按任意键继续..";
getch();
}
else
{
cout<<"没有找到该姓名的学生!
"<<'\n'<cout<<"\n按任意键继续..";
getch();
}
}break;
case2:
{
cout<<"\t\t请输入要查找的学生的学号:
";cin>>Id;
if(p=FindID(Id))
{
p->Next->Show();
cout<<"\n按任意键继续..";
getch();
}
else
{
cout<<"没有找到该学好的学生!
"<<'\n'<cout<<"\n按任意键继续..";
getch();
}
}break;
}
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌修改信息﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
voidStudentmassage:
:
ModifyItem()//修改信息
{
system("cls");
charname[20];
Student*p=NULL;
cout<<"请输入要修改的人的姓名:
";cin>>name;
if(p=FindItem(name))
{
cout<<"已找到学生的信息,请输入新的信息!
"<p->Next->Input();
cout<<"\n修改成功!
"<cout<<"\n按任意键继续..";
getch();
}
else
{
cout<<"\n没有找到!
"<cout<<"\n按任意键继续..";
getch();
}
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌删除信息﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
voidStudentmassage:
:
RemoveItem()//删除信息
{
system("cls");
charname[20];
Student*p=NULL,*temp=NULL;
cout<<"请输入要删除的学生的姓名:
"<>name;
if(p=FindItem(name))
{
temp=p->Next;
p->Next=p->Next->Next;
deletetemp;
cout<<"\n删除成功!
"<cout<<"\n按任意键继续..";
getch();
}
else
{
cout<<"\n没有找到!
"<cout<<"\n按任意键继续..";
getch();
}
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
voidStudentmassage:
:
Swap(Student*p1,Student*p2)//交换两个combox变量的数据域
{
Student*temp=newStudent;
strcpy(temp->name,p1->name);
strcpy(temp->Id,p1->Id);
strcpy(temp->sex,p1->sex);
strcpy(temp->origin,p1->origin);
temp->Cnum=p1->Cnum;
temp->Enum=p1->Enum;
temp->Pnum=p1->Pnum;
temp->sum=p1->sum;
temp->average=p1->average;
temp->Points=p1->Points;
strcpy(p1->name,p2->name);
strcpy(p1->Id,p2->Id);
strcpy(p1->sex,p2->sex);
strcpy(p1->origin,p2->origin);
p1->Cnum=p2->Cnum;
p1->Enum=p2->Enum;
p1->Pnum=p2->Pnum;
p1->sum=p2->sum;
p1->average=p2->average;
p1->Points=p2->Points;
strcpy(p2->name,temp->name);
strcpy(p2->Id,temp->Id);
strcpy(p2->sex,temp->sex);
strcpy(p2->origin,temp->origin);
p2->Cnum=temp->Cnum;
p2->Enum=temp->Enum;
p2->Pnum=temp->Pnum;
p2->sum=temp->sum;
p2->average=temp->average;
p2->Points=temp->Points;
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
intStudentmassage:
:
ListCount()//统计当前链表的记录总数,返回一个整数
{
if(!
Head)
return0;
intn=0;
for(Student*p=Head->Next;p!
=End;p=p->Next)
{
n++;
}
returnn;
}
//﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌﹌
voidStudentmassage:
:
Sort()//对当前链表进行排序
{
cout<<"Sorting..."<Student*p=NULL,*p1=NULL,*k=NULL;
intn=Studentmassage:
:
ListCount();
if(n<2)
return;
intT;
system("cls");
cout<<"请选择:
\n\n\n\t\t\t1.按总成绩排序\n\t\t\t2.按VC++成绩排序\n\t\t\t3.按英语成绩排序\n";
cout<<"\t\t\t4.按物理成绩排序\n\t\t\t5.按平均成绩排序\n\t\t\t6.按学分积点排序"<<"\n\n";
cin>>T;
switch(T)
{
case1:
{
for(p=Head->Next;p!
=End;p=p->Next)
for(k=p->Next;k!
=End;k=k->Next)
{
if(p->sum>k->sum)
{
Studentmassage:
:
Swap(k,p)