美文网首页
62 - Exceptions

62 - Exceptions

作者: 社交帐号直接注册 | 来源:发表于2018-01-08 20:40 被阅读0次
#include <iostream>
using namespace std;

int main()
{
    try
    {
        int momsage = 30;
        int sonsage = 34;
        if(sonsage > momsage)
        {
            throw 99;
        }
    }
    catch(int x)
    {
        cout << "son can not be older, error " << x << endl;
    }
}

相关文章

网友评论

      本文标题:62 - Exceptions

      本文链接:https://www.haomeiwen.com/subject/uehinxtx.html