本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}