欢迎来到天天文库
浏览记录
ID:55631047
大小:27.00 KB
页数:7页
时间:2020-05-21
《C++实验报告模板.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验XX(例:一):实验名称一、实验目的1.了解线性表(List)的逻辑结构特性,以及这种特性在计算机内的两种存储结构:数组和链表。2.重点是线性表的基本操作在两种存储结构上的实现;其中以链表的操作为侧重点;并进一步学习面向对象的程序设计方法。3.进一步掌握面向对象的程序设计方法,提高程序设计能力。二、实验内容(代码)//TheLifeOfGame.cpp:定义控制台应用程序的入口点。//#include"stdafx.h"#include"life.h"#includeusingnamespacestd;voidinstructions()/*Pre:None.Po
2、st:InstructionsforusingtheLifeprogramhavebeenprinted.*/{cout<<"WelcometoConway'sgameofLife."<3、<<"accordingtothenumberofneighboringcellswhicharealive."<4、5、c==''6、7、8、c=='/t');initial_response=false;}while(c!='y'&&c!='Y'&&c!='n'&&c!='N');return(c=='y'9、10、c=='Y');}intmain()//ProgramtoplayConway'sgameofLife./*Pre:Theusersuppliesaninitialconfigurationoflivingcells.Post:Theprogramprintsasequenceofpicturesshowingthechangesintheconfigurationoflivingcellsaccordingtot11、herulesforthegameofLife.Uses:TheclassLifeanditsmethodsinitialize(),print(),andupdate();thefunctionsinstructions(),user_says_yes().*/{Lifeconfiguration;instructions();configuration.initialize();configuration.print();cout<<"Continueviewingnewgenerations?"<12、update();configuration.print();cout<<"Continueviewingnewgenerations?"<13、[maxcol+2];//Allowtwoextrarowsandcolumns.intneighbor_count(introw,intcol);};/**********************************下面是life.cpp***************************/#include"stdafx.h"#include#include"life.h"usingnamespacest
3、<<"accordingtothenumberofneighboringcellswhicharealive."<4、5、c==''6、7、8、c=='/t');initial_response=false;}while(c!='y'&&c!='Y'&&c!='n'&&c!='N');return(c=='y'9、10、c=='Y');}intmain()//ProgramtoplayConway'sgameofLife./*Pre:Theusersuppliesaninitialconfigurationoflivingcells.Post:Theprogramprintsasequenceofpicturesshowingthechangesintheconfigurationoflivingcellsaccordingtot11、herulesforthegameofLife.Uses:TheclassLifeanditsmethodsinitialize(),print(),andupdate();thefunctionsinstructions(),user_says_yes().*/{Lifeconfiguration;instructions();configuration.initialize();configuration.print();cout<<"Continueviewingnewgenerations?"<12、update();configuration.print();cout<<"Continueviewingnewgenerations?"<13、[maxcol+2];//Allowtwoextrarowsandcolumns.intneighbor_count(introw,intcol);};/**********************************下面是life.cpp***************************/#include"stdafx.h"#include#include"life.h"usingnamespacest
4、
5、c==''
6、
7、
8、c=='/t');initial_response=false;}while(c!='y'&&c!='Y'&&c!='n'&&c!='N');return(c=='y'
9、
10、c=='Y');}intmain()//ProgramtoplayConway'sgameofLife./*Pre:Theusersuppliesaninitialconfigurationoflivingcells.Post:Theprogramprintsasequenceofpicturesshowingthechangesintheconfigurationoflivingcellsaccordingtot
11、herulesforthegameofLife.Uses:TheclassLifeanditsmethodsinitialize(),print(),andupdate();thefunctionsinstructions(),user_says_yes().*/{Lifeconfiguration;instructions();configuration.initialize();configuration.print();cout<<"Continueviewingnewgenerations?"<12、update();configuration.print();cout<<"Continueviewingnewgenerations?"<13、[maxcol+2];//Allowtwoextrarowsandcolumns.intneighbor_count(introw,intcol);};/**********************************下面是life.cpp***************************/#include"stdafx.h"#include#include"life.h"usingnamespacest
12、update();configuration.print();cout<<"Continueviewingnewgenerations?"<13、[maxcol+2];//Allowtwoextrarowsandcolumns.intneighbor_count(introw,intcol);};/**********************************下面是life.cpp***************************/#include"stdafx.h"#include#include"life.h"usingnamespacest
13、[maxcol+2];//Allowtwoextrarowsandcolumns.intneighbor_count(introw,intcol);};/**********************************下面是life.cpp***************************/#include"stdafx.h"#include#include"life.h"usingnamespacest
此文档下载收益归作者所有