




已阅读5页,还剩23页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
武汉理工大学基础强化课程设计说明书学 号: 0121010340109课 程 设 计题 目 校友录系统中学校管理的 设计与实现学 院计算机科学与技术学院专 业计算机科学与技术专业班 级计算机1001班姓 名陈明炼指导教师许毅2012年7月4日28目录1系统描述1.1问题说明1.2数据结构1.3函数功能举例2系统设计2.1内存数据结构设计2.2数据文件设计2.3输入/输出设计2.3.1输入设计2.3.2输出设计2.4用户界面设计2.4.1主界面设计2.4.2添加界面设计2.4.3查询界面设计2.4.4删除界面设计2.4.5修改界面设计3程序代码设计与调试4系统测试5设计的特点和不足6收获与体会7参考文献 计算机基础强化训练任务书学生姓名: 陈明炼 专业班级: 计算机1001 指导教师: 许毅 工作单位:计算机科学与技术学院 题 目: 校友录系统中学校管理的设计与实现初始条件:理论:学完计算机基础知识,掌握C/C+语言编程基础和VC开发平台的使用。实践:计算机科学系实验中心提供计算机及软件开发环境。要求完成的主要任务:(包括课程设计工作量及其技术要求,以及说明书撰写等具体要求)(1)系统需求分析,得到系统的数据需求和功能需求,分析结果用表格形式记录。(2)系统设计,包括内存数据结构设计、数据文件设计、代码设计、输入/输出设计、用户界面设计、处理过程设计。要求内存数据用链表组织,数据文件用文本文件,用户界面用字符界面,枚举量用枚举类型表示。至少实现数据记录的增加、修改、删除、查询及相应结果的显示,查询应能按不同数据项进行。(3)编制好程序后,设计若干测试用例,上机测试并通过所设计的程序系统。(4)设计报告按格式要求书写。设计报告书正文的内容应包括: 1系统描述,包括问题说明、数据需求和功能需求;2系统设计,包括内存数据结构设计、数据文件设计、代码设计、输入/输出设计、用户界面设计、处理过程设计的说明;3系统测试,包括测试用例的描述,测试方法和测试结果;4设计的特点、不足、收获与体会。时间安排:设计安排一周(2121周(7月6-10日):周1上午:指导教师介绍开发平台的使用、文件操作等。周1下午:完成系统分析、代码设计、文件设计、输入设计、输出设计、用户界面设计和处理过程设计。周2-周4:完成程序设计与调试,并撰写设计报告书。周五全天:设计验收并收取设计报告(第1-8节课到实验中心进行上机验收)。 指导教师签名: 2012 年6月 28日 系主任(或责任教师)签名: 2012年 6月 29日课程信息管理的设计与实现1系统描述1.1问题说明编写程序,实现课程信息管理。要求采用链表组织结构,数据要保存成文本,要能实现课程信息的查询、添加、修改、删除和打印操作。课程信息的内容包括学生名称、学号、性别、年龄、出生日期、入学日期、主修的专业。1.2数据结构 本程序采用链表做数据存储,无论是数据的查询,添加,删除,显示等均通过指针操作,结果保存在txt文件中 用二进制进行存储。1.3函数功能列举 (1)Template Void Make(T& value) 用于控制输入 避免非法输入 (2)Void Student:Insert() 用于对链表进行插入操作,增加数据项 (3)bool Student:Change(char* ID) 用于修改数据项并保存 可用学号查询 也可用姓名查询 保存成功返回Ture (4)bool Student:Delete(char* ID) 用于删除数据项 可使用学号做输入也可以使用名字做输入 删除成功返回Ture 并提示成功 (5)StudentNode* Student:Search(char *ID) 用于查询数据项 可以用学号输入 也可用 姓名输入 查找成功 返回 查找的项 并对查找项 输出 (6)void Print(StudentNode* stu)用于对单个数据项的输出 (7)void Print(Student stud)用于对整个数据进行输出 (8)void Getout(Student stud)该函数用于将硬盘上的存储的数据读取到内存中 (9)void Getin(Student stud)该函数用于将内存上的数据存入到硬盘上的txt文件中 (10)int main() 主函数. 2系统设计2.1内存数据结构设计(1)每个数据项用以下结构表示struct StudentNode long student_number; char student_ID20; long born_year; long enter_year; long out_year; int born_month; int age; char name20; char sex10; char major30; StudentNode* Next;(2) 链表结构为class Student public: Student() extra_student.Next=0; first=&extra_student; void Insert(); bool Change(char* ID); bool Delete(char* ID); StudentNode* Search(char* ID); StudentNode* GetHead() return first; private: StudentNode extra_student; StudentNode *first;2.2数据文件使用 新建文本文档.txt文本文件保存数据。2.3输入/输出设计2.3.1输入设计输入学生信息void Student:Insert() int i=1; StudentNode* newStudent=new StudentNode; cout Please Iuput the data of the student:endl; coutnewStudent-student_ID; coutnewStudent-name; coutnewStudent-sex; coutborn_year); coutborn_month); coutenter_year); coutout_year); coutage); coutnewStudent-major; StudentNode* now=first; while(now-Next!=0) now=now-Next; i+; newStudent-student_number=i; now-Next=newStudent; newStudent-Next=0; coutInserted Overendl;2.3.2输出设计(1)对数据单项输出 void Print(StudentNode* stu) coutNumber: student_numberendl; coutStudent ID: student_IDendl; coutStudent Name: nameendl; coutStudent Sex: sexendl; coutStudent Age: ageendl; coutStudent BornDate: born_year.born_monthendl; coutStudent Enter Year: enter_year Out Year: out_yearendl; coutStudent Major: majorNext=0) coutThere is no Students.Next!=0) now=now-Next; Print(now); 2.4用户界面设计2.4.1主界面设计int main() coutendlendlendlendl; cout*; cout Please Choose The Operation.endl; cout 1.Add the imformation of the student.endl; cout 2.Change the imformation of the student.endl; cout 3.Delate the imformation of the student.endl; cout 4.Search or Show the imformation of the student.endl; cout 5.Layout all The Imformation of The Student.endl; cout 6.Exit.endl; cout*; coutendlendlendl; 2.4.2添加界面设计void Student:Insert() int i=1; StudentNode* newStudent=new StudentNode; cout Please Iuput the data of the student:endl; coutnewStudent-student_ID; coutnewStudent-name; coutnewStudent-sex; coutborn_year); coutborn_month); coutenter_year); coutout_year); coutage); coutnewStudent-major; StudentNode* now=first; while(now-Next!=0) now=now-Next; i+; newStudent-student_number=i; now-Next=newStudent; newStudent-Next=0; coutInserted OverNext=0) coutThere is no student in the system.Next-student_ID,ID)=0) break; if(now-Next-Next=0) coutThis Student is not in the System.Please Check Again.Next; now=now-Next; return now;2.4.4删除界面设计bool Student:Delete(char* ID) StudentNode *now=first; StudentNode *p; if(now-Next=0) coutThere is no student in the system.Next-student_ID,ID)=0|strcmp(now-Next-name,ID)=0) break; if(now-Next-Next=0) coutThis Student is not in the System.Please Check Again.Next; p=now-Next; now-Next=p-Next; delete p; while(now-Next!=0) now-Next-student_number-=1; now=now-Next; return true;2.4.5修改信息界面设计bool Student:Change(char* ID) int i; StudentNode *now=first; StudentNode *newStudentNode=new StudentNode; StudentNode *p; if(now-Next=0) coutThere is no student in the system.Next-student_ID,ID)=0|strcmp(now-Next-name,ID)=0) break; if(now-Next-Next=0) coutThis Student is not in the System.Please Check Again.Next; cout Please Input The New Imformation.endl; cout Please Input the Student ID:newStudentNode-student_ID; cout Please Input the Student name:newStudentNode-name; cout Please Input the Student sex:newStudentNode-sex; cout Please Input the Student born year:born_year); cout Please Input the Student born month:born_month); cout Please Input the Student Enter year:enter_year); cout Please Input the Student Out year:out_year); cout Please Input the Student age:age); cout Please Input the Student MajornewStudentNode-major; p=now-Next; newStudentNode-student_number=p-student_number; newStudentNode-Next=p-Next; now-Next=newStudentNode; delete p; return true;3程序代码设计与调试#include/载入头文件#include#include#include#includeusing namespace std;struct StudentNode /定义数据项数据结构 long student_number; char student_ID20; long born_year; long enter_year; long out_year; int born_month; int age; char name20; char sex10; char major30; StudentNode* Next;class Student /定义链表结构 public: Student() /构造函数 extra_student.Next=0; first=&extra_student; void Insert(); bool Change(char* ID); bool Delete(char* ID); StudentNode* Search(char* ID); StudentNode* GetHead() /得到头指针 return first; private: StudentNode extra_student; /附加头结点 StudentNode *first; /头指针;templatevoid Make(T &value) /避免非法输入 cinvalue; while(!cin) coutInput Error,Please Input Again.value; cin.clear(); cin.sync();void Student:Insert() /插入算法 int i=1; StudentNode* newStudent=new StudentNode; cout Please Iuput the data of the student:endl; coutnewStudent-student_ID; coutnewStudent-name; coutnewStudent-sex; coutborn_year); coutborn_month); coutenter_year); coutout_year); coutage); coutnewStudent-major; StudentNode* now=first; while(now-Next!=0) now=now-Next; i+; newStudent-student_number=i; now-Next=newStudent; newStudent-Next=0; coutInserted OverNext=0) coutThere is no student in the system.Next-student_ID,ID)=0|strcmp(now-Next-name,ID)=0) break; if(now-Next-Next=0) coutThis Student is not in the System.Please Check Again.Next; cout Please Input The New Imformation.endl; cout Please Input the Student ID:newStudentNode-student_ID; cout Please Input the Student name:newStudentNode-name; cout Please Input the Student sex:newStudentNode-sex; cout Please Input the Student born year:born_year); cout Please Input the Student born month:born_month); cout Please Input the Student Enter year:enter_year); cout Please Input the Student Out year:out_year); cout Please Input the Student age:age); cout Please Input the Student MajornewStudentNode-major; p=now-Next; newStudentNode-student_number=p-student_number; newStudentNode-Next=p-Next; now-Next=newStudentNode; delete p; return true;bool Student:Delete(char* ID) /删除算法 StudentNode *now=first; StudentNode *p; if(now-Next=0) coutThere is no student in the system.Next-student_ID,ID)=0|strcmp(now-Next-name,ID)=0) break; if(now-Next-Next=0) coutThis Student is not in the System.Please Check Again.Next; p=now-Next; now-Next=p-Next; delete p; while(now-Next!=0) now-Next-student_number-=1; now=now-Next; return true;StudentNode* Student:Search(char* ID) StudentNode *now=first; if(now-Next=0) coutThere is no student in the system.Next-student_ID,ID)=0) break; if(now-Next-Next=0) coutThis Student is not in the System.Please Check Again.Next; now=now-Next; return now;void Print(StudentNode* stu) /输出单个数据项 coutNumber: student_numberendl; coutStudent ID: student_IDendl; coutStudent Name: nameendl; coutStudent Sex: sexendl; coutStudent Age: ageendl; coutStudent BornDate: born_year.born_monthendl; coutStudent Enter Year: enter_year Out Year: out_yearendl; coutStudent Major: majorNext=0) coutThere is no Students.Next!=0) now=now-Next; Print(now); void Getout(Student stud)/ 内存输入函数 StudentNode* fir=stud.GetHead(); ifstream infile(D:新建 文本文档.txt,ios:binary); StudentNode *tool=new StudentNode; if(!infile.eof() infile.read(char* )tool,sizeof(StudentNode); if(tool-student_number!=1) delete tool; infile.close(); return; fir-Next=tool; while(!infile.eof() StudentNode* mid=new StudentNode; tool-Next=mid; infile.read(char*) mid,sizeof(StudentNode); if(tool-student_number+1)!=mid-student_number) delete mid; tool-Next=0; infile.close(); return; tool=mid; tool-Next=0; infile.close();void Getin(Student stud) /内存输出函数 ofstream outfile(D:新建 文本文档.txt,ios:binary); StudentNode* mid=stud.GetHead()-Next; if(mid=0) outfile.close(); return ; while(mid-Next!=0) outfile.write(char*)mid,sizeof(StudentNode); mid=mid-Next; outfile.write(char*)mid,sizeof(StudentNode); outfile.close(); return ;int main() /主函数 Student wuhanligong; Getout(wuhanligong); while(true) int i; coutendlendlendlendl; cout*; cout Please Choose The Operation.endl; cout 1.Add the imformation of the student.endl; cout 2.Change the imformation of the student.endl; cout 3.Delate the imforma
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年初中生物特岗教师招聘考试全真模拟题及答案详解
- 全脑开发教学课件
- 用电安全基础知识培训
- 2024年内蒙古包头市行政管理、人事管理等管理人员综合技能知识考试及解析答案
- 2025至2030中国兴趣点(POI)数据解决方案行业运营态势与投资前景调查研究报告
- 2025至2030中国香肠生产线行业产业运行态势及投资规划深度研究报告
- 2025至2030中国办公健身车行业发展趋势分析与未来投资战略咨询研究报告
- 莒县期末考试题目及答案
- 辽宁摩托车考试题库及答案
- 辽宁专科考试题库及答案
- GB/T 1229-2006钢结构用高强度大六角螺母
- 初中现代文精品阅读10篇
- 第一章-马克思主义的诞生-(《马克思主义发展史》课件)
- 有创血压测量操作评分标准
- 架桥机事故案例警示-课件
- 茶文化与茶疗课件
- 班组长执行力管理培训
- 家谱图和家庭治疗课件
- 外研版六年级上册英语 Module 2 单元测试卷(含听力音频)
- 2022年北京市中考地理试题及参考答案
- 干燥塔安装施工工艺标准
评论
0/150
提交评论