首页 > 试题广场 >

找出下列函数中main()的错误。 int main(int

[问答题]
找出下列函数中main()的错误。
int main(int argc, char*argv[])  // 糟糕风格的例子
{
  // ...
  bool in_error = false;
  while (*Driver::input) {
    try {
      Lexer::get_token();
      if (Lexer::curr_tok == Lexer::END) break;
      if (Lexer::curr_tok == Lexer::PRINT) {
        in_error = false;
        continue;
      }
      if (in_error == false) cout << Parser::expr(false) << '\n';
    }
    catch (Error::Zero_divide) {
      cerr << "attempt to divide by zero\n";
      in_error = ture;
    }
    catch (Error::Syntax_error e) {
      cerr << "syntax error:" << e.p << "\n";
    }
  }
  if (Driver::input ! = &std::cin) delete Driver::input;
  return Driver::no_of_errors;
}

这道题你会答吗?花几分钟告诉大家答案吧!