⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 town.cpp

📁 使用DIJKSTAR算法解决多点最短路径,还带文字解说
💻 CPP
字号:
#include "town.h"


town::town()
{
	townName = " ";
	edges = NULL;
}

town::~town()
{
	delete edges;
}

void town::setTownName(string townName_Info)
{
	townName = townName_Info;
}

string town::getTownName()
{
	return townName;
}

void town::setList(list* edges_Info)
{
	edges = edges_Info;
}

list* town::getList()
{
	return edges;
}

void town::setList(double* data, int size, int townsize)
{
    edges = new list();
	int index = 0;
	for ( int j = 0; j < size; j++)
	{
		index += townsize - 1 - j;
	}
	for(int i = 0; i < townsize - size - 1; i++)
	{
		connection con;
		con.setIndex_start(size);
		con.setIndex_end(size + i +1);
		con.setKm(data[index+i]);
		edges->insert_in_order(con);
		//edges.insert_in_order(
	}
	setList(edges);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -