顺序表建立学生康表.docVIP

  • 1
  • 0
  • 约6.39千字
  • 约 10页
  • 2019-05-07 发布于江苏
  • 举报
题目 学生健康情况管理系统 【问题描述】 实现学生健康情况管理的几个操作功能(新建、插入、删除、从文件读取、写入文件和查询、屏幕输出等功能)。健康表中学生的信息有学号、姓名、出生日期、性别、身体状况等。 【实验内容】 必做内容 利用顺序存储结构来实现 系统的菜单功能项如下: 1------新建学生健康表 2------向学生健康表插入学生信息 3------在健康表删除学生信息 4------从文件中读取健康表信息 5------向文件写入学生健康表信息 6------在健康表中查询学生信息(按学生学号来进行查找) 7------在屏幕中输出全部学生信息 8-----退出 程序如下: #include iostream #include fstream using namespace std; /* * 学生结点的设置,包含学号stuID,姓名name,出生日期BirthOfDate, 性别sex(B、G),健康状况(A,B,C) */ struct birthday //出生日期 { unsigned short day; unsigned short month; unsigned short year; }; struct Sstudent //一个学生的基本信息 { char stuID[12]; //学号 char name[12]; //名字 struct birthday bd; //出生日期 char sex[4]; //性别 char healthcase[10]; //健康情况 Sstudent(){} void input(); //输入学生的基本信息 void output(); //输出学生的基本信息 void operator =(Sstudent s); bool operator (Sstudent s); bool operator == (Sstudent s); bool operator (Sstudent s); }; void Sstudent::input() //输入一个学生的信息 { cout请输入学生信息:endl; cout请输入学生的学号:; cinstuID; cout请输入学生的名字:; cinname; cout请输入学生的性别:; cinsex; cout请输入学生生日的日期(年、月、日):; cinbd.yearbd.monthbd.day; cout请输入学生的健康情况(良好或差):; cinhealthcase; coutendl; } void Sstudent::output() //输出一个学生的信息 { cout学号: stuIDendl 姓名: nameendl 性别: sexendl 生日: bd.year/bd.month/bd.dayendl 健康情况: healthcaseendlendl; } void Sstudent::operator =(Sstudent s) { strcpy(stuID,s.stuID); strcpy(name,s.name); strcpy(sex,s.sex); bd.year=s.bd.year; bd.month=s.bd.month; bd.day=s.bd.day; strcpy(healthcase,s.healthcase); } bool Sstudent::operator (Sstudent s) { if(strcmp(stuID,s.stuID) == -1) //若number 小于 s.number return true; else return false; } bool Sstudent::operator == (Sstudent s) { if( !strcmp(name,s.name) ) //若name 等于 s.number if( !strcmp(stuID,s.stuID) ) //若num 等于 s.number return true; return false; } bool Sstudent::operator (Sstudent s) {

文档评论(0)

1亿VIP精品文档

相关文档