当前位置: 首页>>代码示例>>C++>>正文


C++ map::getTown方法代码示例

本文整理汇总了C++中map::getTown方法的典型用法代码示例。如果您正苦于以下问题:C++ map::getTown方法的具体用法?C++ map::getTown怎么用?C++ map::getTown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在map的用法示例。


在下文中一共展示了map::getTown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PQR

int PQR(map &a_map, dijkstra &a_D) {
	string a;
	int b, c;
	vector<bus>::difference_type townSize;
	townSize = a_map.getTown()->size() - 1;

	cout << "Please enter the start time:\n";
	a = cinTime();
	cout << "Please enter the departure town number (0.." << townSize << "):\n";
	b = select();
	cout << "Please enter the destination town number (0.." << townSize
			<< "):\n";
	c = select();

	string tmpTrace = a_D.QuickestR(a_map, a, b, c);
	string trace = (char) (b + 48) + tmpTrace;
	if (tmpTrace.empty()) {
		cout << "Journey not possible\n";
		return 1;
	}

	cout << trace << endl;
	a_map.displayTrace(trace, a);
	return 0;
}
开发者ID:crhan,项目名称:251A2,代码行数:25,代码来源:assignment.cpp

示例2: pDirectBus

int pDirectBus(map &a_map) {
	cout << "Please enter a town number (0.." << (a_map.getTown()->size() - 1)
			<< "):\n";
	int townIndex = select();
	a_map.print_DBus(townIndex);

	return 0;
}
开发者ID:crhan,项目名称:251A2,代码行数:8,代码来源:assignment.cpp

示例3: PEAT

int PEAT(map &a_map, dijkstra &a_D) {
	string a;
	int b, c;
	vector<bus>::difference_type townSize;
	townSize = a_map.getTown()->size() - 1;

	cout << "Please enter the start time:\n";
	a = cinTime();
	cout << "Please enter the departure town number (0.." << townSize << "):\n";
	b = select();
	cout << "Please enter the destination town number (0.." << townSize
			<< "):\n";
	c = select();

	cout << a_D.earlyAT(a_map, a, b, c) << endl;

	return 0;
}
开发者ID:crhan,项目名称:251A2,代码行数:18,代码来源:assignment.cpp

示例4: pNextDB

int pNextDB(map &a_map) {
	string depT;
	vector<bus>::difference_type townSize;
	int a, b;
	townSize = a_map.getTown()->size() - 1;

	//Collecting informations
	cout << "Please enter the start time:\n";
	depT = cinTime();
	cout << "Please enter the departure town number (0.." << townSize << "):\n";
	a = select();
	cout << "Please enter the destination town number (0.." << townSize
			<< "):\n";
	b = select();
	a_map.print_NBus(depT, a, b);

	return 0;
}
开发者ID:crhan,项目名称:251A2,代码行数:18,代码来源:assignment.cpp

示例5: readInFile

int readInFile(string fileName, map &bMap) {
	ifstream readin;
	readin.open(fileName.c_str());

	//Initialize towns name
	int cirTime(0);
	readin >> cirTime;

	for (int i = 0; i < cirTime; ++i) {
		string a;
		readin >> a;
		bMap.newTown(a);
	}

	//insert buses into town
	cirTime = 0;
	readin >> cirTime;
	for (int i = 0; i < cirTime; ++i) {
		int a, b;
		string c, d;
		readin >> a >> b >> c >> d;

		//insert "0" if time string only have three digits
		if (c.length() == 3) {
			c = "0" + c;
		}
		if (d.length() == 3) {
			d = "0" + d;
		}

		bMap.getTown(a)->addBus(b, c, d);
	}
	readin.close();

	return 0;
}
开发者ID:crhan,项目名称:251A2,代码行数:36,代码来源:assignment.cpp


注:本文中的map::getTown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。