automata for c++