- 1、本文档共4页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
校园导游咨询2
校园导游设计
graph.h这个库文件是要自己写的,不是系统给的。2楼的都把代码给出来了\\graph.h---类的声明,包含在这个文件中class Graph{public:Graph(int point);~Graph();Graph addpath(int point1,int point2);Graph addview(int point);void addinformation(int point);bool searchview(int point);void shortdistance();void showgraph();private:int **graph; -------二维数组char **information ----景点的信息说明int number;};
\\graph.cpp---类的实现#includeiostream#includegraph.hGraph::Graph(int point){number=point;graph=new int*[point+1];fot(int i=0;i=point;i++)graph[i]=new int[point];for(int i=0;i=number;i++)for(int j=0;j=number;j++)graph[i][j]=0;information=new char*[number+1];for(int i=0;i=number;i++)information[i]=new char[100];}
void Graph::addinformation(int point){cout请输入第point个景点的信息endl;cininformation[point];}
Graph::~Graph(){for(int i=0;inumber;i++)delete[]graph[i];delete[]graph;number=0;}
bool Graph::addpath(int point1,int point2){if(graph[point1][point2]==0){cout这条边已经存在,已经不能在插入!endl;return o;}graph[point1][[point2]=1;return 1;}
Graph Graph::addview(int point){int **p=new int*[point+1];for(int i=0;i=point;i++)p[i]=new int[point];for(int i=0;i=point;i++)for(int j=0;j=point;j++)p[i][j]=0;for(int j=1;j=number;j++)for(int i=1;i=number;i++)p[i][j]=graph[i][j];char**pp=new char*[point+1];for(int i=0;i=point;i++)pp[i]=new char[100];for(int i=1;i=number;i++)strcpy(pp[i],information[i])number=point;information=pp;graph=p;return *this;}
Graph Graph::addpath(int point1,int point2){if(graph[point1][point2]==1||graph[point2][point1]==1)throw error; ----这个还没有开始定义了graph[point1][point2]=graph[point2][point1]=1;return *this;}
bool Graph::searchview(int point){if(point0||pointnumber){cout你所查询的景点不存在endl;return 0;}coutinformation(point)endl;return 1;}
void Graph::shortdistance(int point1,int point2){int **t=new int*[number+1];for(int i=0;i=number;i++)t[i]=new int[number+1];for(int i=0;i=number;i++)for(int j=0;j=number;j++)t[i][j]=graph[i][j];int **path=new int*[number+1];for(int i=0;
您可能关注的文档
- 无公害食品 茄果类蔬菜.doc
- 无怨无悔 不朽的青春.正文.doc
- 无公害猪牛羊指标.doc
- 无私奉献成教招生答考生问.doc
- 无醇啤酒饮料的研制2009.2.26.doc
- 无负压供水设备负压消除技术基本说明.doc
- 无锡市社会保险经办能力建设总体方案.doc
- 无锡市劳务协议范本.doc
- 无领导小组讨论流程模拟.doc
- 无线电调试工中级D.doc
- 2025-2030年中国水暖加温系统项目投资可行性研究分析报告.docx
- 2025-2030年中国绳带多色塑胶拉头行业深度研究分析报告.docx
- 2025-2030年中国园单支筷行业深度研究分析报告.docx
- 2025-2030年中国金属丸项目投资可行性研究分析报告.docx
- 2025-2030年中国三色直条笔杆行业深度研究分析报告.docx
- 2025-2030年中国海鲜榨菜芯项目投资可行性研究分析报告.docx
- 2025-2030年中国摩托车油泵项目投资可行性研究分析报告.docx
- 2025-2030年中国文娱体育用品项目投资可行性研究分析报告.docx
- 2025年部门绩效考核细则(精选11篇).pdf
- 2025-2030年中国日杂项目投资可行性研究分析报告.docx
最近下载
- 育才三中(初二年级)校本课程开设安排表2007.3.doc
- 古诗词诵读 《客至》 课件(共26张PPT)统编版高中语文选择性必修下册.pptx VIP
- 《中医学》教学大纲.docx VIP
- 2022《真希望我父母读过这本书》读后感.docx VIP
- 真希望我父母读过这本书精品课件模板.pptx VIP
- 2025年湘潭医卫职业技术学院单招面试模拟试题及答案解析.docx
- 污水处理中的污泥脱水浓缩技术考核试卷.docx VIP
- 我真希望我父母读过这本书读后感.docx VIP
- 2024年湖南城建职业技术学院单招职业技能测试题库(考试直接用).docx VIP
- DB62T 4919-2024苜蓿草高水分打捆技术规程.pdf VIP
文档评论(0)