C++程序设计原理与实践

2018-11-01

2018-11-01  本文已影响0人  Jianbaozi
int main() {
    try {
        double val = 0;
        while (cin) {
            Token t = ts.get();
            while (t.kind == result) t = ts.get(); //吃掉所有的分号
            if (t.kind == quit) { //先判断是否退出
                system("pause");
                return 0;
            }
            ts.push_back(t); //不是分号的再放回去
            cout << "=" << expression() << endl;
        }
        system("pause");
        return 0;
    }
    catch (exception e) {
        cerr << e.what() << endl;
        system("pause");
        return 1;
    }catch (...) {
        error("oops.Unknown exception!");
        system("pause");
        return 2;
    }
    system("pause");
}
上一篇下一篇

猜你喜欢

热点阅读