数据结构与算法综合实验 图与景区信息管理系统

这是一篇关于武汉理工大学数据结构与算法综合实验的报告,主要介绍了利用图的理论来设计和实现一个景区信息管理系统。软件zy1702小组HJ参与了该项目。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 武汉理工大学数据结构与算法综合实验--- 图与景区信息管理系统

                                         软件zy1702  HJ

//main.cpp
#include <iostream>
#include "Tourism.h";
#include "Graph.h"
struct Graph m_Graph;
using namespace std;

void show_menu() {
	cout << "=====景区信息管理系统=====" << endl;
	cout << "1.创建景区景点图" << endl;
	cout << "2.查询景点信息" << endl;
	cout << "3.旅游景点导肮" << endl;
	cout << "4.搜索最短路径" << endl;
	cout << "5.铺设电路规划" << endl;
	cout << "0.退出" << endl;
	cout << "请输入操作编号(0~5):";

}
int main() {
	char option[20];
	
	while (true) {
		system("pause");
		system("cls");
		show_menu();
		cin >> option;
		if (strcmp(option, "1") == 0) {
			CreateGraph();
		}
		else if (strcmp(option, "2") == 0) {			
			GetSpotInfo();
		}
		else if (strcmp(option, "3") == 0) {
			TravelPath();
		}
		else if (strcmp(option, "4") == 0) {
			FindShortPath();
		}
		else if (strcmp(option, "5") == 0) {
			DesignPath();
		}
		else if (strcmp(option, "0") == 0) {
			break;
		}
	}
	return 0;
}

 

//Graph.cpp
#include <iostream>
#include <bits/stdc++.h>
#include "Graph.h"
#include "Tourism.h"
extern struct Graph m_Graph;
using namespace std;

void Init(void) {
	m_Graph.m_nVexNum = 0;
	for (int i = 0; i < 20; i++) {
		strcpy(m_Graph.m_aVexs[i].name, "");
		strcpy(m_Graph.m_aVexs[i].desc, "");
		m_Graph.m_aVexs[i].num = -1;
		for (int j = 0; j < 20; j++) {
			if (i == j) m_Graph.m_aAdjMatrix[i][j] = 0;
			else m_Graph.m_aAdjMatrix[i][j] = MAX;
		}
		
	}

}// 初始化图结构。
void InsertVex(Vex sVex,int i) {
	m_Graph.m_aVexs[i].num =sVex.num;
	strcpy(m_Graph.m_aVexs[i].name, sVex.name);
	strcpy(m_Graph.m_aVexs[i].desc, sVex.desc);

}// 将顶点添加到顶点数组中。
void InsertEdge(Edge sEdge) {
	m_Graph.m_aAdjMatrix[sEdge.vex1][sEdge.vex2] = sEdge.weight;
	m_Graph.m_aAdjMatrix[sEdge.vex2][sEdge.vex1] = sEdge.weight;
}// 将边保存到邻接矩阵中。
void GetVex(int nVex) {
	
	cout << m_Graph.m_aVexs[nVex].name << endl;
	cout << m_Graph.m_aVexs[nVex].desc << endl;
	cout << "-----周边景区-----" << endl;
	FindEdge(nVex);

}// 查询指定顶点信息。
int FindEdge(int nVex) {
	
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值