if (dataIn == '12')
Oops
Your check function is embedded in another function. C++ doesn't allow that.