main.cpp

来自「SSD6卡耐基梅陇大学OP7答案 绝对正确 SSD6数据结构 是一门很重要的课程」· C++ 代码 · 共 53 行

CPP
53
字号
#pragma warning (disable:4786)
#pragma warning (disable:4503)

#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 + =
减小字号Ctrl + -
显示快捷键?