第十二讲_异常处理.pptVIP

  • 11
  • 0
  • 约9.57千字
  • 约 30页
  • 2017-06-22 发布于湖北
  • 举报
//account.cpp中仅以下成员函数的实现与例11-13不同,其它内容皆与之完全相同 void Account::error(const string msg) const { throw AccountException(this, msg); } //12_4.cpp仅主函数的实现与例11_13.cpp不同,其它皆与之完全相同 int main() { Date date(2008, 11, 1); //起始日期 Controller controller(date); string cmdLine; const char *FILE_NAME = commands.txt; ifstream fileIn(FILE_NAME); //以读模式打开文件 if (fileIn) { //如果正常打开,就执行文件中的每一条命令 while (getline(fileIn, cmdLine)) { try { controller.runCommand(cmdLine); } catch (exception e) { cout Bad line in FILE_NAME : cmdLine endl; cout Error: e.what() end

文档评论(0)

1亿VIP精品文档

相关文档