运行 ❯
获取您
自己
的网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> using namespace std; int main() { try { int age = 15; if (age >= 18) { cout << "Access granted - you are old enough."; } else { throw 505; } } catch (int myNum) { cout << "Access denied - You must be at least 18 years old.\n"; cout << "Error number: " << myNum; } return 0; }
访问被拒绝 - 您必须年满 18 岁。
错误号:505