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

📄 main.cpp

📁 这是一个很有用的练习题
💻 CPP
字号:
#include <iostream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <queue>

#include "City.h"
#include "Service.h"
#include "RailSystem.h"

using namespace std;

int main(int argc, char* argv[]) {

    try {

        RailSystem rs("services.txt");

        while (true) {

            cerr << "\n\nEnter a start and destination city:  ('quit' to exit)\n";

            string from, to;
            cin >> from;
            if (from == "quit") break;
            cin >> to;

            if (rs.is_valid_city(from) && rs.is_valid_city(to)) {
                rs.output_cheapest_route (from, to, cout);
            } else {
                cout << "Please enter valid cities\n\n";
            }

        }

        return EXIT_SUCCESS;

    } catch (exception& e) {
        cerr << e.what() << endl;
    } catch (...) {
        cerr << "Unknown exception caught\n";
    }

    return EXIT_FAILURE;
}

⌨️ 快捷键说明

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