运行 ❯
获取
自己的
网站
×
更改方向
更改主题,深色/浅色
转到 Spaces
#include <iostream> using namespace std; int main() { try { int age = 20; if (age >= 18) { cout << "Access granted - you are old enough."; } else { throw (age); } } catch (int myNum) { cout << "Access denied - You must be at least 18 years old.\n"; cout << "Age is: " << myNum; } return 0; }
授予访问权限 - 你已足够大。