- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
#include iostream
#include fstream
#includecstring
#includeconio.h
#include ctime
using namespace std;
struct Class
{
int Chinese;
int Math;
int English;
};
class Student
{
public:
Student();
void Ofile(ofstream of);
void Infile(ifstream f);
void Out();
void Set(char *name,int no,Class score);
char *GetName();
int GetNo();
Student *Next;
protected:
char Name[20];
int No;
Class Score;
};
Student::Student():Next(0){}
char *Student::GetName()
{
return Name;
}
int Student::GetNo()
{return No;}
void Student::Set(char *name,int no,Class score)
{
strcpy(Name,name);
No=no;
Score=score;
}
void Student::Infile(ifstream f)
{
fNameNoScore.ChineseScore.MathScore.English; // 将数据输入到文
件
}
void Student::Ofile(ofstream of)
{
of Name No Score.Chinese Score.Math Score.English;
从文件中提取数据
}
void Student::Out()
{
coutName\tNo\tScore.Chinese\t\tScore.Math\t\tScore.Englis
h\tendl;
}
class Function
{
public:
Function();
~Function();
void Menu();
void Add();
void Search();
void Delete();
void Modify();
void Show();
private:
Student *Student_First;
void Read();
void Save();
};
Function::Function()
{
Student_First=new Student;
Read();
}
Function::~Function()
{
delete Student_First;
}
void Function::Add()
{
char name[20];
int no;
Class score;
功能类
构造函数
析构函数
菜单函数
录入学生成绩函数
查询学生成绩函数
删除学生成绩函数
修改学生成绩函数
显示学生成绩函数
读取学生成绩函数
保存学生成绩信息函数
录入学生成绩信息函数
char choose;
Student *f1,*p,*f2;
system(cls);
f1=Student_First;
f2=Student_First-Next;
while(f1-Next) f1=f1-Next;
do
{
p=new Student;
cout 请输入您要添加的学生成绩信息 :endl;
cout 请输入学生姓名 :;
cinname;
while(f2)
{
if(strcmp(f2-GetName(),name)==0)
{
cout 该学生已存在,请确定姓名 !\n\n;
cout 请输入姓名 :;
cinname;
break;
}
f2=f2-Next;
}
cout 请输入学号 :;
cinno;
cout 请输入语文成绩 :;
cinscore.Chinese;
cout 请输入数学成绩 :;
cinscore.Math;
cout 请输入英语成绩 :;
cinscore.English;
p-Set(name,no,score);
f1-Next=p;
p-Next=NULL;
f1=f1-Next;
cout 是否继续输入信息 ?(Y\\N) endl;
cinchoose;
}
while(choose==y||choose==Y);
Save();
cout1. 返回主菜单 endl;
cinchoose;
while(choose!=1)
{
cout1.返回主菜单 endl;
cinchoose;
}
Menu();
}
void Function::Delet
文档评论(0)