throw2.cpp.svn-base

来自「QT方面的开发」· SVN-BASE 代码 · 共 46 行

SVN-BASE
46
字号
#include <iostream>void foo() {    int  i, j;    i = 14;    j = 15;    throw i;}void call_foo() {    int  k;    k  = 12;    foo();}int main() {    using namespace std;    try {        cout << "In the outer try block" << endl;        try {            call_foo(); /* foo exited with i and j destroyed */        }        catch(int n) {            cout << "I can't handle this exception!" << endl;            throw;        }    }     catch(float z) {        cout << "Wrong catch!" << endl;    }    catch(char s) {        cout << "This is also wrong!" << endl;    }    catch(int n) {        cout << "\ncaught it " << n << endl;    }    cout << "Just below the outermost try block." << endl;}/*OutIn the outer try blockI can't handle this exception! caught it 14Just below the outermost try block.*/

⌨️ 快捷键说明

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