欢迎来到天天文库
浏览记录
ID:53093128
大小:47.00 KB
页数:8页
时间:2020-04-01
《实验报告格式1.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、实验报告专业____数字媒体技术__班级__2012级__学号_120472012028___姓名吴业蕾实验日期:2014年月日报告退发(订正、重做)课程数据结构与算法实验名称一、实验目的二、实验环境(描述实验的软件、硬件环境)三、实验内容、步骤和结果分析#include#includeusingnamespacestd;structstudent{public:intnum;charname[3];datebirthday;intscore;};templateclassstudent
2、{public:student(){count=0;maxsize=5;m=newElemType[maxsize];}voiddefalt(constElemType&s);intlength()const;voidInsert(intnumber,constElemType&s);voidGetElem(intnumber,constElemType&s);voidSetElem(intnumber,constElemType&s);voidDelete(intnumber);voidlook(intn);voidinput();public:in
3、tcount;intmaxsize;ElemType*p;};templatevoidstudent::defalt(constElemType&infor){if(count==maxsize){return;}m[count++]=infor;}templateintstudent::length()const{returncount;}templatevoidstudent::GetElem(int
4、number,constElemType&s){if(number<1
5、
6、number>length()){cout<<"over";}else{m[number]=s;}}templatevoidstudent::SetElem(intnumber,constElemType&s){if(number<1
7、
8、number>length()){cout<<"over";}else{m[number-1]=s;}}templatevoidstudent::
9、Insert(intnumber,constElemType&s){intlen=length();count++;for(intcurnumber=len;curnumber>=number;curnumber--){GetElem(curnumber,p[curnumber-1]);}SetElem(number,s);}templatevoidstudent::look(intn){intlen=length();for(intcurnumber=0;curnumber10、++){if(p[curnumber].num==n){cout<=len)cout<<"错误"<voidstudent::input(){inti;for(i=0;i11、hday<voidstudent::Delete(intnumber){intlen=length();for(intcurpst=number-1;curpst<=len;curpst++){p[curpst]=p[curpst+1];}count--;}intmain(){studentstuinf;structstudeinfor[4]={{001,"张三",2005,70},{002,"李四",2004,65}};inti,s12、,delpt,pt;intlookn;studeputin;cout<<"请输入对应数"<
10、++){if(p[curnumber].num==n){cout<=len)cout<<"错误"<voidstudent::input(){inti;for(i=0;i11、hday<voidstudent::Delete(intnumber){intlen=length();for(intcurpst=number-1;curpst<=len;curpst++){p[curpst]=p[curpst+1];}count--;}intmain(){studentstuinf;structstudeinfor[4]={{001,"张三",2005,70},{002,"李四",2004,65}};inti,s12、,delpt,pt;intlookn;studeputin;cout<<"请输入对应数"<
11、hday<voidstudent::Delete(intnumber){intlen=length();for(intcurpst=number-1;curpst<=len;curpst++){p[curpst]=p[curpst+1];}count--;}intmain(){studentstuinf;structstudeinfor[4]={{001,"张三",2005,70},{002,"李四",2004,65}};inti,s
12、,delpt,pt;intlookn;studeputin;cout<<"请输入对应数"<
此文档下载收益归作者所有