Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ throe

try {
  int age = 15;
  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.
";
  cout << "Age is: " << myNum;
}
 
PREVIOUS NEXT
Tagged: #throe
ADD COMMENT
Topic
Name
5+1 =