The syntax should be something like -

Code:
#include <iostream>

using namespace std;

void solver(int x){ 
	if (x == 0)
       throw ("x found to be 0") ;
}

int main() { 
	try { solver(0); } 
	catch(char* a){ 
	cout<<a << '\n' ; //end catch 
	} 
	return 0;
}
If you don't wish to exit the program you'll either have to call the solver function again after it has thrown or move your try/catch block into the solver function.