#include <iostream>
int main() {
try {
int age = 15;
if (age >= 18) {
std::cout << "Access granted - you are old enough.";
} else {
throw (age);
}
} catch (int myNum) {
std::cout << "Access denied - you must be at least 18 years old.\n";
std::cout << "Your current age: " << myNum;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: