Based on your response to my comments. If you are trying to check if the stack is not empty you should use !BracketsCheck.empty()
also:
int validate(string string)
is probably not a good idea since you will hiding the string
type.
top() will return a reference or const reference not a pointer and if your stack is empty you should not be calling top
.
I would also discourage you from using:
using namespace std;
it is considered bad practice I realize typing std::
all the time can be annoying at first but you really do get used to it after a while.
Finally validate
needs a return
statement since it is supposed to return int
and flowing off the end of function without a return in this case will invoke undefined behavior as per 6.6.3
The return statement paragraph 2 from the draft C++ standard.