If I try it (with minor mods because I don't have your "nl" value):
#include <iostream>
using namespace std;
int main(){
cout<<"Hello World\n";
int x = 1;
try{
if(x == 1){
throw 99;
}
cout << "Hey\n";
}
catch(int err){
cout << err << "\n";
}
cout<<"Goodbye\n";
return 0;
}
It does exactly what I expected it to:
Hello World
99
Goodbye
...Program finished with exit code 0
Press ENTER to exit console.
So ... what am I doing that you aren't?