📄 map.cpp
字号:
#include "map.h"
#include "town.h"
#include <iostream>
using namespace std;
map::map()
{
townSize = 0;
maps = NULL;
}
map::map(int townSize)
{
this->townSize = townSize;
maps = new town[townSize];
}
map::~map()
{
//delete maps;
}
void map::setTownSize(int townSize)
{
this->townSize = townSize;
maps = new town[townSize];
}
town* map::getMap()
{
return maps;
}
int map::getTownSize()
{
return townSize;
}
void map::setMap(string *name, double *km)
{
int town_length = getTownSize();
for(int i_town = 0; i_town < town_length; i_town++)
{
maps[i_town].setTownName(name[i_town]);
maps[i_town].setList(km,i_town,town_length);
}
}
void map::printMap()
{
for(int i_town = 0; i_town < townSize-1; i_town++)
{
cout<<"city: "<<maps[i_town].getTownName()<<endl;
cout<<"connect: "<<endl;
maps[i_town].getList()->print();
}
}
town* map::getTownIndex(int Size)
{
town* townpointer = NULL;
townpointer = &maps[Size];
return townpointer;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -