- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
校园导游咨询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至2030全球及中国超收敛集成系统行业细分市场及应用领域与趋势展望研究报告.docx
- 2025至2030尖齿铣刀行业市场占有率及有效策略与实施路径评估报告.docx
原创力文档


文档评论(0)